add led bar
This commit is contained in:
parent
c39e10b2e7
commit
223ea26eb4
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -21,24 +21,38 @@ uint8_t led_pin=4;
|
|||
uint8_t led_status;
|
||||
}
|
||||
|
||||
#include <Grove_LED_Bar.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue