Skip to content

Commit 7be30bd

Browse files
fontamiHwfbraghiroli
authored andcommitted
Added SME basic examples
Added examples for: -rgb study -user button study -sme initialization result
1 parent bd21834 commit 7be30bd

File tree

3 files changed

+155
-0
lines changed

3 files changed

+155
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
Shows How to use the SmartEverything RGB Led
3+
4+
created 14 Jun 2015
5+
6+
*/
7+
8+
9+
int i = 0;
10+
11+
void setup() {
12+
LED_GREEN_INIT;
13+
LED_BLUE_INIT;
14+
LED_RED_INIT;
15+
pinMode(PIN_LED_RXL, OUTPUT);
16+
pinMode(PIN_LED_TXL, OUTPUT);
17+
18+
}
19+
20+
void loop() {;
21+
22+
switch (i) {
23+
case 0:
24+
i++;
25+
LED_GREEN_ON(HIGH);
26+
break;
27+
28+
case 1:
29+
i++;
30+
LED_RED_ON(HIGH);
31+
break;
32+
33+
case 2:
34+
i = 0;
35+
LED_BLUE_ON(HIGH);
36+
break;
37+
38+
default:
39+
break;
40+
}
41+
digitalWrite(PIN_LED_RXL, LOW);
42+
digitalWrite(PIN_LED_TXL, LOW);
43+
delay(100);
44+
45+
46+
LED_GREEN_ON(LOW);
47+
LED_BLUE_ON(LOW);
48+
LED_RED_ON(LOW);
49+
digitalWrite(PIN_LED_RXL, HIGH);
50+
digitalWrite(PIN_LED_TXL, HIGH);
51+
delay(100);
52+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
Shows The result of the sme initialization phase
3+
4+
created 16 Jun 2015
5+
6+
*/
7+
8+
#include <Arduino.h>
9+
10+
void setup() {
11+
SerialUSB.begin(115200);
12+
}
13+
14+
void loop() {
15+
16+
SerialUSB.print("SmartEverything initialization = ");
17+
18+
if (smeInitError == 0){
19+
SerialUSB.println("SUCCEED !");
20+
LED_GREEN_ON(HIGH);
21+
}
22+
else {
23+
SerialUSB.println("ERROR !");
24+
// // ERROR !!!!!!! FLASH EVERYTHING
25+
26+
pinMode(PIN_LED_RXL, OUTPUT);
27+
pinMode(PIN_LED_TXL, OUTPUT);
28+
int i=0;
29+
30+
while(1){
31+
switch (i) {
32+
case 0:
33+
i++;
34+
LED_GREEN_ON(HIGH);
35+
break;
36+
37+
case 1:
38+
i++;
39+
LED_RED_ON(HIGH);
40+
break;
41+
42+
case 2:
43+
i=0;
44+
LED_BLUE_ON(HIGH);
45+
break;
46+
47+
default:
48+
break;
49+
}
50+
digitalWrite(PIN_LED_RXL, LOW);
51+
digitalWrite(PIN_LED_TXL, LOW);
52+
delay(100);
53+
54+
55+
LED_GREEN_ON(LOW);
56+
LED_BLUE_ON(LOW);
57+
LED_RED_ON(LOW);
58+
digitalWrite(PIN_LED_RXL, HIGH);
59+
digitalWrite(PIN_LED_TXL, HIGH);
60+
delay(100);
61+
};
62+
}
63+
64+
delay(2000);
65+
66+
}
67+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* userButton.ino
3+
*
4+
* Example to sohws how the 2 userbutton works on Smarteverything
5+
*
6+
* Created: 6/17/2015 10:32:11 PM
7+
*
8+
* Author: Mik
9+
*
10+
*/
11+
12+
#include <Arduino.h>
13+
14+
15+
// the setup function runs once when you press reset or power the board
16+
void setup() {
17+
18+
// LED & User Button are already initilized by the SME core.
19+
// it is not required to do here
20+
}
21+
22+
// the loop function runs over and over again forever
23+
void loop() {
24+
25+
if (button1IsPressed()) {
26+
LED_BLUE_ON(HIGH);
27+
} else {
28+
LED_BLUE_ON(LOW);
29+
}
30+
31+
if (button2IsPressed()) {
32+
LED_RED_ON(HIGH);
33+
} else {
34+
LED_RED_ON(LOW);
35+
}
36+
}

0 commit comments

Comments
 (0)