|
|
@@ -11,12 +11,18 @@ |
|
|
|
///------------------------------------------------------------------------------------------------- |
|
|
|
|
|
|
|
//define used GPIO pins |
|
|
|
#define TAC1 7 |
|
|
|
#define TAC2 8 |
|
|
|
#define TAC3 9 |
|
|
|
#define TAC4 10 |
|
|
|
#define TAC5 11 |
|
|
|
#define TAC6 12 |
|
|
|
#define TAC1 13 //PWM |
|
|
|
#define TAC2 11 //PWM |
|
|
|
#define TAC3 10 //PWM |
|
|
|
#define TAC4 9 //PWM |
|
|
|
#define TAC5 6 //PWM |
|
|
|
#define TAC6 5 //PWM |
|
|
|
//reserve |
|
|
|
#define TAC7 3 //PWM |
|
|
|
#define TAC8 2 |
|
|
|
#define TAC9 1 |
|
|
|
#define TAC10 0 |
|
|
|
|
|
|
|
|
|
|
|
#define LED 13 |
|
|
|
|
|
|
@@ -52,6 +58,10 @@ void set_PinMode() |
|
|
|
pinMode(TAC4, OUTPUT); |
|
|
|
pinMode(TAC5, OUTPUT); |
|
|
|
pinMode(TAC6, OUTPUT); |
|
|
|
pinMode(TAC7, OUTPUT); |
|
|
|
pinMode(TAC8, OUTPUT); |
|
|
|
pinMode(TAC9, OUTPUT); |
|
|
|
pinMode(TAC10, OUTPUT); |
|
|
|
|
|
|
|
pinMode(LED, OUTPUT); |
|
|
|
} |
|
|
@@ -65,6 +75,10 @@ void set_AllLow() |
|
|
|
digitalWrite(TAC4, LOW); |
|
|
|
digitalWrite(TAC5, LOW); |
|
|
|
digitalWrite(TAC6, LOW); |
|
|
|
digitalWrite(TAC7, LOW); |
|
|
|
digitalWrite(TAC8, LOW); |
|
|
|
digitalWrite(TAC9, LOW); |
|
|
|
digitalWrite(TAC10, LOW); |
|
|
|
|
|
|
|
digitalWrite(LED, LOW); |
|
|
|
} |
|
|
@@ -73,36 +87,56 @@ void processSerialData(char SerialData) |
|
|
|
{ |
|
|
|
switch(SerialData) |
|
|
|
{ |
|
|
|
case '1': |
|
|
|
case '0': |
|
|
|
digitalWrite(TAC1, !digitalRead(TAC1)); |
|
|
|
Serial.print("Tactilo 1: "); |
|
|
|
Serial.println(digitalRead(TAC1)); |
|
|
|
break; |
|
|
|
case '2': |
|
|
|
case '1': |
|
|
|
digitalWrite(TAC2, !digitalRead(TAC2)); |
|
|
|
Serial.print("Tactilo 2: "); |
|
|
|
Serial.println(digitalRead(TAC2)); |
|
|
|
break; |
|
|
|
case '3': |
|
|
|
case '2': |
|
|
|
digitalWrite(TAC3, !digitalRead(TAC3)); |
|
|
|
Serial.print("Tactilo 3: "); |
|
|
|
Serial.println(digitalRead(TAC3)); |
|
|
|
break; |
|
|
|
case '4': |
|
|
|
case '3': |
|
|
|
digitalWrite(TAC4, !digitalRead(TAC4)); |
|
|
|
Serial.print("Tactilo 4: "); |
|
|
|
Serial.println(digitalRead(TAC4)); |
|
|
|
break; |
|
|
|
case '5': |
|
|
|
case '4': |
|
|
|
digitalWrite(TAC5, !digitalRead(TAC5)); |
|
|
|
Serial.print("Tactilo 5: "); |
|
|
|
Serial.println(digitalRead(TAC5)); |
|
|
|
break; |
|
|
|
case '6': |
|
|
|
case '5': |
|
|
|
digitalWrite(TAC6, !digitalRead(TAC6)); |
|
|
|
Serial.print("Tactilo 6: "); |
|
|
|
Serial.println(digitalRead(TAC6)); |
|
|
|
break; |
|
|
|
case '6': |
|
|
|
digitalWrite(TAC7, !digitalRead(TAC7)); |
|
|
|
Serial.print("Tactilo 7: "); |
|
|
|
Serial.println(digitalRead(TAC7)); |
|
|
|
break; |
|
|
|
case '7': |
|
|
|
digitalWrite(TAC8, !digitalRead(TAC8)); |
|
|
|
Serial.print("Tactilo 8: "); |
|
|
|
Serial.println(digitalRead(TAC8)); |
|
|
|
break; |
|
|
|
case '8': |
|
|
|
digitalWrite(TAC9, !digitalRead(TAC9)); |
|
|
|
Serial.print("Tactilo 9: "); |
|
|
|
Serial.println(digitalRead(TAC9)); |
|
|
|
break; |
|
|
|
case '9': |
|
|
|
digitalWrite(TAC10, !digitalRead(TAC10)); |
|
|
|
Serial.print("Tactilo 10: "); |
|
|
|
Serial.println(digitalRead(TAC10)); |
|
|
|
break; |
|
|
|
case 'b': |
|
|
|
if(digitalRead(LED) == LOW) |
|
|
|
{ |
|
|
@@ -113,7 +147,7 @@ void processSerialData(char SerialData) |
|
|
|
case 'e': |
|
|
|
if(digitalRead(LED) == HIGH) |
|
|
|
{ |
|
|
|
digitalWrite(LED, LOW); |
|
|
|
set_AllLow(); |
|
|
|
Serial.println("...End Tactile Session"); |
|
|
|
} |
|
|
|
break; |