Same code working on bluetooth module connected to arduino b

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
snisal
 
Posts: 1
Joined: Sun Oct 17, 2021 4:44 pm

Same code working on bluetooth module connected to arduino b

Post by snisal »

I am using a feather 32u4 microcontroller bought from Core Electronics. The same code that I was using on an arduino uno/mega with a bluetooth module connected does not seem to work on the adafruit feather 32u4. I am using a Unity3D app for the bluetooth communication, with this plugin, and the following arduino code:

Code: Select all

#define Pin1 9
#define Pin2 10
#define Pin3 11
#define Pin4 12

char data = 0;

char EMSOn = HIGH;
char EMSOff = LOW;


void setup()
{
  pinMode(Pin1, OUTPUT);
  pinMode(Pin2, OUTPUT);
  pinMode(Pin3, OUTPUT);
  pinMode(Pin4, OUTPUT);
  Serial.begin(9600);
  digitalWrite(Pin1, EMSOff);
  digitalWrite(Pin2, EMSOff);
  digitalWrite(Pin3, EMSOff);
  digitalWrite(Pin4, EMSOff);
}
void loop()
{
  if (Serial.available() > 0)
  {
data = Serial.read();
Serial.print(data);
Serial.print("\n");
if (data == 'A')
digitalWrite(Pin1, EMSOn);
else if (data == 'a')
digitalWrite(Pin1, EMSOff);
else if (data == 'B')
digitalWrite(Pin2, EMSOn);
else if (data == 'b')
digitalWrite(Pin2, EMSOff);
else if (data == 'C')
digitalWrite(Pin3, EMSOn);
else if (data == 'c')
digitalWrite(Pin3, EMSOff);
else if (data == 'D')
digitalWrite(Pin3, EMSOn);
else if (data == 'd')
digitalWrite(Pin3, EMSOff);
  }
}

Locked
Please be positive and constructive with your questions and comments.

Return to “Itsy Bitsy Boards”