sexton

Members
  • Content count

    2
  • Joined

  • Last visited

About sexton

  • Rank
    Noob Class

Profile Information

  • Location
    sweden
  1. The code below works in Energia 10,compiles in 11 but does nothing.Can anyone tell why? /* Read internal temperature sensor of LM4F120 Stellaris Launchpad Example from TI LM4F120 workbook A la mode Energia */ #include "Energia.h" #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/debug.h" #include "driverlib/sysctl.h" #include "driverlib/adc.h" unsigned long ulADC0Value[4]; volatile unsigned long ulTempAvg; volatile unsigned long ulTempValueC; volatile unsigned long ulTempValueF; volatile unsigned long tt; volatile unsigned long tc; void setup() { Serial.begin(9600); pinMode(RED_LED, OUTPUT); pinMode(GREEN_LED, OUTPUT); pinMode(BLUE_LED, OUTPUT); SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); SysCtlADCSpeedSet(SYSCTL_ADCSPEED_125KSPS); // 250 ADCSequenceDisable(ADC0_BASE, 1); ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0); ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_TS); ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_TS); ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_TS); ADCSequenceStepConfigure(ADC0_BASE, 1, 3, ADC_CTL_TS | ADC_CTL_IE | ADC_CTL_END); ADCSequenceEnable(ADC0_BASE, 1); } void loop() { ADCIntClear(ADC0_BASE, 1); ADCProcessorTrigger(ADC0_BASE, 1); while(!ADCIntStatus(ADC0_BASE, 1, false)) { } ADCSequenceDataGet(ADC0_BASE, 1, ulADC0Value); ulTempAvg = (ulADC0Value[0] + ulADC0Value[1] + ulADC0Value[2] + ulADC0Value[3] + 2)/4; ulTempValueC = (1475 - ((2475 * ulTempAvg)) / 4096); ulTempValueF = ((ulTempValueC * 9) + 160) / 5; Serial.println(ulTempValueC); for (int tc =1;tc <=ulTempValueC/100;tc ++) dot(); tt=ulTempValueC%100; for (int ttt =1;ttt <=abs(tt/10);ttt ++) gdot(); for (int tc =1;tc <=ulTempValueC%10;tc ++) bdot(); delay(3000); } void dot() { digitalWrite(RED_LED, HIGH); delay(250); digitalWrite(RED_LED, LOW); delay(250); } void gdot() { digitalWrite(GREEN_LED, HIGH); delay(250); digitalWrite(GREEN_LED, LOW); delay(250); } void bdot() { digitalWrite(BLUE_LED, HIGH); delay(250); digitalWrite(BLUE_LED, LOW); delay(250); }
  2. I posted before but it still says i didn't!