Hi!
My problem is about how you would write that if button C on a wii nunchuck is pressed in Arduino language.
I want Arduino to know that if button C is pressed, then should a servo move 20 degrees. When i'm writing it like this I get an error.
if (wii.buttonC(1)); {
vertServo.write(20);
delay(1500);
vertServo.write(20);
delay(100);
(1 stands for magnetization on)
This is my error:
Arduino:1.8.2 (Windows 7), Kort:"Arduino/Genuino Uno"
C:\Users\Isac\Desktop\p_sklov_kod\p_sklov_kod.ino: In function 'void loop()':
p_sklov_kod:91: error: cannot convert 'Wiichuck::buttonC' from type 'uint8_t (Wiichuck::)() {aka unsigned char (Wiichuck::)()}' to type 'bool'
if (wii.buttonC); { //when button C is pressed
^
exit status 1
cannot convert 'Wiichuck::buttonC' from type 'uint8_t (Wiichuck::)() {aka unsigned char (Wiichuck::)()}' to type 'bool'
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
How can I write so that a servo moves 20 degrees if buttonC is pressed.