LED: Added C Src and Example

Changed from Grove LED to LED.

Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
This commit is contained in:
Abhishek Malik
2016-09-12 16:16:30 -07:00
committed by Noel Eck
parent 1caf805d2b
commit f9a36314fb
17 changed files with 481 additions and 10 deletions

View File

@ -115,6 +115,7 @@ add_example (loudness)
add_example (tsl2561)
add_example (collision)
add_example (moisture)
add_example (led)
# Custom examples
add_custom_example (nmea_gps_i2c-example-c nmea_gps_i2c.c nmea_gps)

24
examples/c/led.c Normal file
View File

@ -0,0 +1,24 @@
//Modified: Abhishek Malik <abhishek.malik@intel.com>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "led.h"
void main(void)
{
led_context dev = led_init(2);
while(1){
if(led_on(dev) != UPM_SUCCESS){
printf("problem turning the LED on\n");
}
upm_delay(1);
if(led_off(dev) != UPM_SUCCESS){
printf("problem turning the LED off\n");
}
upm_delay(1);
}
led_close(dev);
}