mirror of
https://github.com/eclipse/upm.git
synced 2025-07-01 17:31:13 +03:00
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:
@ -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
24
examples/c/led.c
Normal 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);
|
||||
}
|
Reference in New Issue
Block a user