mirror of
https://github.com/supleed2/ELEC50003-P1-CW.git
synced 2024-11-10 01:35:50 +00:00
Added a very basic test sketch to test components on breadboard before first draft of main sketch.
This commit is contained in:
parent
29d1ace16b
commit
7478a4b0db
38
Command/main/main.ino
Normal file
38
Command/main/main.ino
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
const int potPin = 27;
|
||||||
|
const int butPin = 16;
|
||||||
|
const int U_Led = 14;
|
||||||
|
const int L_Led = 12;
|
||||||
|
const int R_Led = 15;
|
||||||
|
const int D_Led = 13;
|
||||||
|
int potVal = 0;
|
||||||
|
bool butState = 0;
|
||||||
|
void setup() {
|
||||||
|
// put your setup code here, to run once:
|
||||||
|
Serial.begin(115200);
|
||||||
|
pinMode(U_Led, OUTPUT);
|
||||||
|
pinMode(L_Led, OUTPUT);
|
||||||
|
pinMode(R_Led, OUTPUT);
|
||||||
|
pinMode(D_Led, OUTPUT);
|
||||||
|
pinMode(butPin, INPUT_PULLUP);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// put your main code here, to run repeatedly:
|
||||||
|
//potVal = analogRead(potPin);
|
||||||
|
//Serial.println(potVal);
|
||||||
|
butState = digitalRead(butPin);
|
||||||
|
if (butState == LOW) {
|
||||||
|
// turn LED on:
|
||||||
|
digitalWrite(U_Led, HIGH);
|
||||||
|
digitalWrite(L_Led, HIGH);
|
||||||
|
digitalWrite(R_Led, HIGH);
|
||||||
|
digitalWrite(D_Led, HIGH);
|
||||||
|
} else {
|
||||||
|
// turn LED off:
|
||||||
|
digitalWrite(U_Led, LOW);
|
||||||
|
digitalWrite(L_Led, LOW);
|
||||||
|
digitalWrite(R_Led, LOW);
|
||||||
|
digitalWrite(D_Led, LOW);
|
||||||
|
}
|
||||||
|
delay(20);
|
||||||
|
}
|
Loading…
Reference in a new issue