A
Arduino•3y ago
robherc

Bluetooth module issues

@LuciferDK
15 Replies
robherc
robhercOP•3y ago
please summarize your problem here
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
robherc
robhercOP•3y ago
//Bluetooth controlled led test

char Incoming_value = 0;
int ledPin = 13;


void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(13, OUTPUT);


}

void loop() {
// put your main code here, to run repeatedly:
if(Serial.available() > 0)
{
Incoming_value = Serial.read();
Serial.print(Incoming_value);

if(Incoming_value == 1){
Serial.println("LED On");
digitalWrite(ledPin, HIGH);
}

if(Incoming_value == 2){
Serial.println("LED Off");
digitalWrite(ledPin, LOW);
}

}
delay(100);
}
//Bluetooth controlled led test

char Incoming_value = 0;
int ledPin = 13;


void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(13, OUTPUT);


}

void loop() {
// put your main code here, to run repeatedly:
if(Serial.available() > 0)
{
Incoming_value = Serial.read();
Serial.print(Incoming_value);

if(Incoming_value == 1){
Serial.println("LED On");
digitalWrite(ledPin, HIGH);
}

if(Incoming_value == 2){
Serial.println("LED Off");
digitalWrite(ledPin, LOW);
}

}
delay(100);
}
!codeblock
Arduino
Arduino•3y ago
How to Send Code Blocks
Surround the code in three backticks
If using new lines, a file extension can be placed directly after the first 3 backticks to highlight in that language. An example is shown below, highlighting code in arduino. The backtick key is typically found to the left of the 1 key.
From An unknown user
Arduino Bot • Submit bugs on GitHub!
robherc
robhercOP•3y ago
...makes your code a lot easier to read 😉
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
robherc
robhercOP•3y ago
I use ```js [return] before the code, then ``` after the code, to get the colored highlighting in the code block hmmm....yeah, it could be that it's sending ASCII characters '1' and '2', but that'd be kinda weird they're "backticks", not "apostrophes" ... if you're on a computer, it's the key to the left of the '1' key
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
AnonEngineering
AnonEngineering•3y ago
ASCII "1" is hex 0x31
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
AnonEngineering
AnonEngineering•3y ago
single characters use ' ', strings of characters use " "
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
AnonEngineering
AnonEngineering•3y ago
np!
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
robherc
robhercOP•3y ago
lol, now you better understand what I meant with my explanation of the differences between 1, '1', and "1" ty, I was failing to remember that today, for whatever reason.

Did you find this page helpful?