Changeset 243 for rtos_arduino/trunk/examples/NCESIoT_RTOS
- Timestamp:
- Jun 15, 2016, 4:09:12 PM (8 years ago)
- Location:
- rtos_arduino/trunk/examples/NCESIoT_RTOS
- Files:
-
- 13 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
rtos_arduino/trunk/examples/NCESIoT_RTOS/Makefile
r242 r243 62 62 APPL_COBJS += 63 63 64 APPL_DIR += ./ChainableLED 65 APPL_CXXOBJS += ChainableLED.o 66 APPL_COBJS += 67 64 68 include $(RCA_DIR)/lib/Makefile.rca -
rtos_arduino/trunk/examples/NCESIoT_RTOS/rca_app.cpp
r242 r243 6 6 #include <Digital_Light_TSL2561.h> 7 7 #include <SeeedOLED.h> 8 #include <ChainableLED.h> 9 10 #define LED_PIN 4 11 12 void setup() 13 { 14 Serial.begin(115200); 15 pinMode(LED_PIN, OUTPUT); 16 } 17 18 void loop() 19 { 20 digitalWrite(LED_PIN, HIGH); // turn the LED on (HIGH is the voltage level) 21 delay(1000); // wait for a second 22 digitalWrite(LED_PIN, LOW); // turn the LED off by making the voltage LOW 23 delay(1000); // wait for a second 24 } 25 8 26 9 27 #define TOUCH_PIN 3 … … 11 29 int is_update_oled; 12 30 13 void setup()31 void task1_setup() 14 32 { 15 Serial.begin(115200);16 33 Wire.begin(); 17 34 TSL2561.init(); … … 23 40 } 24 41 25 void loop() 26 { 42 void task1_loop() 43 { 44 int lux; 45 46 lux = TSL2561.readVisibleLux(); 27 47 Serial.print("The Light value is: "); 28 Serial.println( TSL2561.readVisibleLux());48 Serial.println(lux); 29 49 30 50 if (is_update_oled == 1) { 31 51 wai_sem(OLED_SEM); 32 SeeedOled.clearDisplay(); 33 SeeedOled.putNumber(TSL2561.readVisibleLux()); 52 SeeedOled.setTextXY(0, 0); 53 SeeedOled.putNumber(lux); 54 SeeedOled.putString(" "); 34 55 sig_sem(OLED_SEM); 35 56 } … … 45 66 #endif /* USE_INTERRUPT */ 46 67 47 void task 1_setup()68 void task2_setup() 48 69 { 49 70 pinMode(TOUCH_PIN, INPUT_PULLUP); … … 53 74 } 54 75 55 void task 1_loop()76 void task2_loop() 56 77 { 57 78 #ifdef USE_INTERRUPT … … 75 96 } 76 97 } 98 99 #define NUM_LEDS 1 100 101 ChainableLED leds(8, 9, NUM_LEDS); 102 103 void task3_setup() 104 { 105 leds.init(); 106 } 107 108 float hue = 0.0; 109 boolean up = true; 110 int count = 0; 111 112 void task3_loop() 113 { 114 for (byte i=0; i<NUM_LEDS; i++) 115 leds.setColorHSB(i, hue, 1.0, 0.5); 116 117 delay(50); 118 119 if (up) 120 hue+= 0.025; 121 else 122 hue-= 0.025; 123 124 if (hue>=1.0 && up) 125 up = false; 126 else if (hue<=0.0 && !up) 127 up = true; 128 } -
rtos_arduino/trunk/examples/NCESIoT_RTOS/rca_app.h
r242 r243 2 2 #define _RCA_APP_H_ 3 3 4 #define RCA_NUM_TASK 14 #define RCA_NUM_TASK 3 5 5 6 6 #endif /* _RCA_APP_H_ */
Note:
See TracChangeset
for help on using the changeset viewer.