-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
44 lines (37 loc) · 971 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/** Mittels DigitalOut kann eine Positive Spannung an einem Pin erzeugt werden.
*/
#include "mbed.h"
DigitalOut led1( MBED_CONF_IOTKIT_LED1 );
DigitalOut led2( MBED_CONF_IOTKIT_LED2 );
DigitalOut led3( MBED_CONF_IOTKIT_LED3 );
DigitalOut led4( MBED_CONF_IOTKIT_LED4 );
// Wartezeit
#define WAIT_TIME 500
int main()
{
while(1)
{
// kurze Schreibweise, operator= ist ueberschrieben
led1 = 1;
led2 = 0;
led3 = 0;
led4 = 0;
thread_sleep_for( WAIT_TIME );
// Aufruf der Methode
led1.write( 0 );
led2.write( 1 );
led3.write( 0 );
led4.write( 0 );
thread_sleep_for( WAIT_TIME );
led1 = 0;
led2 = 0;
led3 = 1;
led4 = 0;
thread_sleep_for( WAIT_TIME );
led1 = 0;
led2 = 0;
led3 = 0;
led4 = 1;
thread_sleep_for( WAIT_TIME );
}
}