Zoran Roncevic
Published © GPL3+

Flip & Click Board with Bluetooth

Testing Flip&Click board. This board is Arduino DUE based with Mikroelektronika Mikrobus 4 slot.

BeginnerProtip824
Flip & Click Board with Bluetooth

Things used in this project

Hardware components

Android device
Android device
×1
MikroE Flip & Click
×1
MikroE Button click
×1
MikroE Bluetooth click
×1

Software apps and online services

Android bluetooth terminal

Story

Read more

Code

Code snippet #1

Arduino
//Button click  => D-socket
#define btn 29 //PD.6
#define led 9 //PC.21

//Bluetooth click => A-socket, Serial1

void setup() {
  // put your setup code here, to run once:
  pinMode(btn,INPUT);
  pinMode(led,OUTPUT);
  Serial.begin(115200);
  Serial1.begin(115200);

  digitalWrite(led,LOW);
}

void loop() {
  // put your main code here, to run repeatedly:

  // send message for button pressing
  if (digitalRead(btn) == HIGH){
    Serial1.println("btn_pressed");
    delay(300);
  }

  //receive message from bluetooth
  if (Serial1.available()){
    while(Serial1.available() > 0){
      char data;
      data = Serial1.read();
      if (data == '1'){
        digitalWrite(led,HIGH);
      }
      if (data == '0'){
        digitalWrite(led,LOW);
      }
      Serial.write(data);
    }

  }
  
}

Credits

Zoran Roncevic

Zoran Roncevic

19 projects • 124 followers
Hackster Live ambassador in Serbia. Organizer of Maker NS community.

Comments