you use myservo.attach(A4); but A4 is not defined
you have like for pos to declare A4 and initialize it
you should put gb.begin befoe too but it’s should not make change for this.
A4 should be defined by default because the Arduino IDE knows that the Arduino Uno (ATMega328P, same microprocessor as used for the Makerbuino) has an analog input/output labeled “A4”.
@Samilpatel
I can’t spot any error within the code.
This can’t be the whole error message. Please copy and paste the whole text within the compiling window.
Do you really need to use the analog input/output A4?
Have you try begin by gb.begin();and put myservo.attach(A4); after ?
Nothing which can explain the problem but to make it easiest to move into yout programm and correct it, you should use indentation.
For example for:
void loop() {
if(gb.update()){
You don’t loose time to identify your blocs, but your problem don’t seems to be linked to that. But it’s maybe just a display problem as you hadn’ used the Preformated text format into your message.
But if i was you i’ll try to put gb.begin just after the setup line as it’s better to make the init of the gb hardware before starting to use it…
Arduino’s Servo library uses Timer1 for generating the signal for controlling servos.
The Gamebuino library is using Timer1 too for sound generation.
I think this is causing the problem.
Please, check this article and try utilising timer2 for this cause:
That’s what I’ve found out during the weekend too. I’m pretty sure that this is causing the problem. I’ve copied and compiled the code and there we’re some more lines of errors, not just “exit status 1
Error compiling for board Arduino/Genuino Uno.”.
D:\Users\XXXXXX\AppData\Local\Temp\arduino_build_566975\libraries\Gamebuino\utility\Sound.cpp.o (symbol from plugin): In function `Sound::command(unsigned char, unsigned char, signed char, unsigned char)’:
(.text+0x0): multiple definition of `__vector_11’
D:\Users\XXXXXX\AppData\Local\Temp\arduino_build_566975\libraries\Servo\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
…
…
…
exit status 1
Error compiling for board Arduino/Genuino Uno.
There you can see that the Servo library is interfereing with the gamebuino (sound) library.
So I guess using the tutorial provided by @albertgajsak should fix your problem.