Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int buttonPin = 8;
- int buttonState = 0;
- void setup() {
- pinMode(buttonPin, INPUT);
- Serial.begin(38400); // Default communication rate of the Bluetooth module
- }
- void loop() {
- int buttonState = 0;
- delay(100);
- buttonState = digitalRead(buttonPin);
- if (buttonState == HIGH) {
- Serial.write('0'); // Sends '1' to serialout
- }
- else {
- Serial.write('1');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement