diff --git a/examples/osd/lgb-train/Makefile b/examples/osd/lgb-train/Makefile index 5a017eac0..fef4c390e 100644 --- a/examples/osd/lgb-train/Makefile +++ b/examples/osd/lgb-train/Makefile @@ -11,7 +11,7 @@ CONTIKI_WITH_IPV6 = 1 CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" -PROJECT_SOURCEFILES += ${SKETCH}.cpp +PROJECT_SOURCEFILES += ${SKETCH}.cpp Grove_LED_Bar.cpp # automatically build RESTful resources REST_RESOURCES_DIR = ./resources diff --git a/examples/osd/lgb-train/arduino-merkurbaord.geany b/examples/osd/lgb-train/arduino-merkurbaord.geany index 8a57b7973..bd3a46c5a 100644 --- a/examples/osd/lgb-train/arduino-merkurbaord.geany +++ b/examples/osd/lgb-train/arduino-merkurbaord.geany @@ -14,7 +14,7 @@ indent_mode=2 [project] name=arduino-merkurbaord -base_path=/home/harald/install/osd-contiki/examples/osd/arduino-merkurboard/ +base_path=/home/harald/install/osd-contiki/examples/osd/lgb-train description= file_patterns= @@ -23,19 +23,7 @@ long_line_behaviour=1 long_line_column=72 [files] -current_page=11 -FILE_NAME_0=2281;None;0;EUTF-8;1;1;0;%2Fhome%2Fharald%2Finstall%2Fosd-contiki%2Fexamples%2Fosd%2Farduino-soil-moisture%2Fsketch.pde;0;4 -FILE_NAME_1=2895;C;0;EUTF-8;1;1;0;%2Fhome%2Fharald%2Finstall%2Fosd-contiki%2Fexamples%2Fosd%2Farduino-soil-moisture%2Fresources%2Fres-soillight.c;0;4 -FILE_NAME_2=2893;C;0;EUTF-8;1;1;0;%2Fhome%2Fharald%2Finstall%2Fosd-contiki%2Fexamples%2Fosd%2Farduino-soil-moisture%2Fresources%2Fres-soiltemp.c;0;4 -FILE_NAME_3=2177;C;0;EUTF-8;1;1;0;%2Fhome%2Fharald%2Finstall%2Fosd-contiki%2Fexamples%2Fosd%2Farduino-soil-moisture%2Fproject-conf.h;0;4 -FILE_NAME_4=5823;C++;0;EUTF-8;1;1;0;%2Fhome%2Fharald%2Finstall%2Fosd-contiki%2Fexamples%2Fosd%2Farduino-soil-moisture%2FI2CSoilMoistureSensor.cpp;0;4 -FILE_NAME_5=1931;C;0;EUTF-8;1;1;0;%2Fhome%2Fharald%2Finstall%2Fosd-contiki%2Fexamples%2Fosd%2Farduino-soil-moisture%2FI2CSoilMoistureSensor.h;0;4 -FILE_NAME_6=0;None;0;EUTF-8;1;1;0;%2Fhome%2Fharald%2Finstall%2Fsunrise%2FPCTools%2Fpowerconsumption%2FPICOTEST%2Ftemplate%2Fvob-ok%2Faverage2.awk;0;4 -FILE_NAME_7=0;XML;0;EUTF-8;1;1;0;%2Fhome%2Fharald%2Fprojekte%2Fairkey-ez2092%2FEZ2092.sch;0;4 -FILE_NAME_8=0;HTML;0;EUTF-8;1;1;0;%2Fhome%2Fharald%2FDownloads%2FSemesterplan.html;0;4 -FILE_NAME_9=1273;Sh;0;EUTF-8;1;1;0;%2Fhome%2Fharald%2Finstall%2Fpensi%2Fpensi.sh;0;4 -FILE_NAME_10=600;None;0;EUTF-8;1;1;0;%2Fhome%2Fharald%2Fprojekte%2Fairkey-commissioningtest%2FREADME;0;4 -FILE_NAME_11=139;Sh;0;EUTF-8;1;1;0;%2Fhome%2Fharald%2Fprojekte%2Fairkey-energieverbrauch%2Fpowerconsumption%2FPICOTEST%2Fez2092b%2Fez2092a-fw4.54%2Fstartup%2Fmessung.sh;0;4 +current_page=-1 [VTE] last_dir=/home/harald diff --git a/examples/osd/lgb-train/project-conf.h b/examples/osd/lgb-train/project-conf.h index 957c568ad..6c8ede3e4 100644 --- a/examples/osd/lgb-train/project-conf.h +++ b/examples/osd/lgb-train/project-conf.h @@ -37,7 +37,7 @@ #define PLATFORM_HAS_BATTERY 1 -#define LOOP_INTERVAL (30 * CLOCK_SECOND) +#define LOOP_INTERVAL (1 * CLOCK_SECOND) /* Save energy */ //#define RDC_CONF_PT_YIELD_OFF diff --git a/examples/osd/lgb-train/sketch.pde b/examples/osd/lgb-train/sketch.pde index 337949c84..62184224b 100644 --- a/examples/osd/lgb-train/sketch.pde +++ b/examples/osd/lgb-train/sketch.pde @@ -21,24 +21,38 @@ uint8_t led_pin=4; uint8_t led_status; } +#include + +Grove_LED_Bar bar(9, 8, 1); // Clock pin, Data pin, Orientation + void setup (void) { // switch off the led pinMode(led_pin, OUTPUT); digitalWrite(led_pin, HIGH); led_status=0; + // led bar + bar.begin(); // init coap resourcen rest_init_engine (); + #pragma GCC diagnostic ignored "-Wwrite-strings" rest_activate_resource (&res_led, "s/led"); rest_activate_resource (&res_battery, "s/battery"); rest_activate_resource (&res_cputemp, "s/cputemp"); + #pragma GCC diagnostic pop // NETSTACK_MAC.off(1); - mcu_sleep_set(128); + // mcu_sleep_set(128); } void loop (void) { + static int i = 0; + // Walk through the levels + bar.setLevel(i++); + if (i >= 10){ + i=0; + } }