Hello I am a student, I have to create an Arduino program but I have never done one so I am heading to you because I think you could help me. In this program I am supposed to make move, detect and return to its base when it has less than 30%. However I need to be able to move it via Bluetooth. Thank you for your understanding and have a nice day.
Move what?
30% of what?
Start at the beginning.
First read your post, do you think anyone but you can understand what it is your actually wanting to do ?
HI, @piquik
Welcome to the forum.
If this is a school exercise, can you post a copy of the assignment as it was given to you?
Have you had any classes on programming and or Arduino?
Have you written code of any sort before?
What class is this assignment for?
Thanks.. Tom..
![]()
Post the complete task describtion.
Although I didn't really understand the exact task, I know the code for a simple bluetooth car using L293D, a HC08 bluetooth module, a UNO and the mySerial library:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); //Tx,rx
int a;
void setup() {
Serial.begin(9600);
mySerial.begin(9600);
for (int x = 4; x<13; x++) {
pinMode(x, OUTPUT);
}
}
void loop() {
if (mySerial.available()) {
a = mySerial.read();
// Serial.write(a);
Serial.println(a);
if (a == 97) {
for (int x = 4; x<13; x++) {b
digitalWrite(x, LOW);
}
}
if (a == 99) {
// backward
digitalWrite(5, HIGH);
digitalWrite(6, LOW);
digitalWrite(7, HIGH);
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
digitalWrite(10, LOW);
digitalWrite(11, HIGH);
digitalWrite(12, LOW);
}
if (a == 98) {
// forward
digitalWrite(5, LOW);
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
digitalWrite(10, HIGH);
digitalWrite(11, LOW);
digitalWrite(12, HIGH);
}
if (a == 100) {
// left
digitalWrite(5, HIGH);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
digitalWrite(10, HIGH);
digitalWrite(11, LOW);
digitalWrite(12, HIGH);
}
if (a == 101) {
// right
digitalWrite(5, LOW);
digitalWrite(6, HIGH);
analogWrite(7, LOW);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
digitalWrite(10, HIGH);
digitalWrite(11, HIGH);
digitalWrite(12, LOW);
}
if (a == 102) {
digitalWrite(13, HIGH);
}
if (a == 103) {
digitalWrite(13, LOW);
}
}
if (Serial.available()) {
mySerial.write(Serial.read());
}
}
I'd say the area above your setup function could do with a little expansion.
That 'b' should not be there...
Lol. That almost sounds like insulting innuendo.
It was a copying error
The Arduino isn't a general-purpose computer or a robot... It's a microcontroller and everybody has different hardware. It can be used to control a robot, or a model car or something. The software has to be written for YOUR specific hardware.
...None of my Arduino projects have used a motor so they don't move by themselves. ![]()
i'm supposed to move a robot with wheels
30% battery
sorry i am french and i have a little trouble with english
Hello, I've never had a course on programming, it's a discovery for me, that's why I'm asking you for help. This work is for a senior class, sorry for my level of English
Hello, I'm sorry about my level of English, but thank you, because it helps me a lot.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.