nicer formatting

master
BodgeMaster 2021-05-04 09:58:19 +02:00
parent 221e01033e
commit 9cc0955003
1 changed files with 5 additions and 5 deletions

View File

@ -32,9 +32,9 @@ uint8_t getMode(uint8_t pin){
uint8_t toggleState(uint8_t pin){ uint8_t toggleState(uint8_t pin){
uint8_t mode = getMode(pin); uint8_t mode = getMode(pin);
switch (mode){ switch (mode) {
case OUTPUT: case OUTPUT:
if (digitalRead(pin) == HIGH){ if (digitalRead(pin) == HIGH) {
digitalWrite(pin, LOW); digitalWrite(pin, LOW);
return LOW; return LOW;
} else { } else {
@ -56,7 +56,7 @@ uint8_t toogleMode(uint8_t pin){
uint8_t mode = getMode(pin); uint8_t mode = getMode(pin);
// declared here bc it wont let me inside the switch/case statement // declared here bc it wont let me inside the switch/case statement
uint8_t state; uint8_t state;
switch (mode){ switch (mode) {
case OUTPUT: case OUTPUT:
state = digitalRead(pin); state = digitalRead(pin);
pinMode(pin, INPUT); pinMode(pin, INPUT);
@ -84,14 +84,14 @@ uint8_t toogleMode(uint8_t pin){
void setup(){ void setup(){
Serial.begin(115200); Serial.begin(115200);
// set all pins to input and low // set all pins to input and low
for (uint8_t i; i<NUM_DIGITAL_PINS; i++){ for (uint8_t i; i<NUM_DIGITAL_PINS; i++) {
Serial.print("."); Serial.print(".");
if (i==TX_PIN || i==RX_PIN); if (i==TX_PIN || i==RX_PIN);
else pinMode(i, INPUT); else pinMode(i, INPUT);
} }
Serial.print("."); Serial.print(".");
pinMode(LED_BUILTIN, OUTPUT); // set LED to output bc having it as an input would make little sense pinMode(LED_BUILTIN, OUTPUT); // set LED to output bc having it as an input would make little sense
while (Serial.available() > 0){ while (Serial.available() > 0) {
Serial.print("."); Serial.print(".");
Serial.read(); Serial.read();
} }