12345678910111213141516171819202122232425262728293031323334 |
- #include "BluetoothSerial.h"
- BluetoothSerial SerialBT;
- #define PIN_IO 12
- int touch_val = 0;
- void setup() {
- // put your setup code here, to run once:
- pinMode(PIN_IO,INPUT);
- pinMode(LED_BUILTIN, OUTPUT);
- Serial.begin(115200);
- SerialBT.begin("brakeMonitor");
- Serial.println("The brake monitor is ready. Connect via bluetooth");
- }
- void loop() {
- // put your main code here, to run repeatedly:
- touch_val = digitalRead(PIN_IO);
- digitalWrite(LED_BUILTIN,touch_val);
- SerialBT.println("Brake Status:");
- if(touch_val == HIGH){
- SerialBT.println(" X");
- SerialBT.println(" XXX");
- SerialBT.println(" XXXXX");
- SerialBT.println(" XXXXXXX");
- SerialBT.println(" XXXXXXXXX");
- SerialBT.println(" X");
- }else{
- SerialBT.println("GRINCH");
- }
- delay(500);
- }
|