Skip to content

Commit 0db9da9

Browse files
author
Dave 'Gizmo' Gymer
committed
Add Picozmo embedded app.
1 parent 5554a00 commit 0db9da9

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -354,3 +354,4 @@ simconnect.dll
354354
/Controlzmo/wwwroot/js/nosleep/
355355
/Controlzmo/wwwroot/js/signalr/
356356
/Controlzmo/wwwroot/js/jqueryui/
357+
/Picozmo/{RPI-RP2}.lnk

Picozmo/Picozmo.ino

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// https://www.arduino.cc/reference/en/
2+
3+
const uint LED_PIN = PICO_DEFAULT_LED_PIN;
4+
const uint SWITCH1_PIN = D14;
5+
const uint SWITCH2_PIN = D15;
6+
7+
volatile int s1, s2, pot, incoming;
8+
9+
void setup() {
10+
pinMode(LED_PIN, OUTPUT);
11+
pinMode(SWITCH1_PIN, INPUT_PULLUP);
12+
pinMode(SWITCH2_PIN, INPUT_PULLUP);
13+
}
14+
15+
void loop() {
16+
pot = analogRead(A0);
17+
s1 = digitalRead(SWITCH1_PIN) == LOW;
18+
s2 = digitalRead(SWITCH2_PIN) == LOW;
19+
if (incoming != -1) {
20+
digitalWrite(LED_PIN, (incoming & 1) ? HIGH : LOW);
21+
incoming = -1;
22+
}
23+
sleep_ms(5);
24+
}
25+
26+
void setup1() {
27+
// https://www.arduino.cc/reference/en/language/functions/communication/serial/ifserial/
28+
Serial.begin(115200);
29+
Serial.println("setup");
30+
}
31+
32+
void loop1() {
33+
sleep_ms(500);
34+
incoming = Serial.read();
35+
Serial.print(pot);
36+
Serial.print("\t");
37+
Serial.print(s1);
38+
Serial.print("/");
39+
Serial.print(s2);
40+
Serial.print(" read ");
41+
Serial.println(incoming);
42+
}

0 commit comments

Comments
 (0)