guys i cant do my beetle bot 3 in 1 it says 'servopulse' was not declared in this scope
hers the code

19 Replies
we don't use PNG for code. We use copied text only. If it can be loaded into the Arduino IDE directly it's not appropriate for a code question. At all. ;)
oh i will put the code
int servoPin = 9; //Define the pins of the steering gear
void setup() {
pinMode(servoPin, OUTPUT); //steering pin is set to output
servopulse(servoPin, 90); //Turn it to 90 degrees
delay(300); //delay 0.3S
}
void loop(){
void servopulse(int pin, int myangle) { //Impulse function
int pulsewidth = map(myangle, 0, 180, 500, 2500); //Map Angle to pulse width
for (int i = 0; i < 5; i++) { //Output a few more pulses
digitalWrite(pin, HIGH);//Set the steering gear interface level to high
delayMicroseconds(pulsewidth);//Number of microseconds of delayed pulse width value
digitalWrite(pin, LOW);//Lower the level of steering gear interface
delay(20 - pulsewidth / 1000);
digitalWrite(pin, LOW);//Lower the level of steering gear interface delay(20 - pulsewidth / 1000); }
} here
digitalWrite(pin, LOW);//Lower the level of steering gear interface delay(20 - pulsewidth / 1000); }
} here
aight give me a few minutes to reformat it so others can read it.
Okay this is not even code yet.
You opened void loop() { and then .. you began to define a new function inside the loop.
so can you fi xit?
:PostOnlyInOneChannel:
No. You must learn basics. Coding 101 in C++
You do not need to know any details about the Arduino IDE coding environment to fix this coding issue. Nothing. It's a straight up C++ syntax problem.
I personally don't handle these issues here, at all. I don't have the personality to walk someone through all that. We do have people who do so, though.oh so can i dm them
No. They would have to see this post and decide on their own to take an interest in it.
Suprisingly, this happens a lot. Some people here are just very generous of time and other resources. ;) It's pretty amazing, actually.
oh ok
š
boy scout SNV kind of marked you though with the cross post. ;) which they are supposed to do.
so its good?
the board is a keyestudio
nano
Nano usually means 328p - that's a part number for an Atmel (company and brand) of chip (the brains). You program it about the same as the Uno R3.
oh ok
aight well I'm going back to what I was doing. Take a look around here as well and see what you can make of what's going on here. ;) Nice to meet you.
ty so much
You are welcome
I have no idea what you are trying to do but as nis said you have syntax errors. This code will at least compile: