This is my first post. I am trying to learn user defined functions, and am starting with a very simple blink a LED. The code works fine until I try to insert it a user defined function. What am I doing wrong? I am attaching a copy of the code. The error message is as follows:
Arduino: 1.8.2 (Windows 10), Board: “Arduino/Genuino Uno”
C:\Users\Ken Burr\Documents\Arduino\user_define_function_to_blink_LED\user_define_function_to_blink_LED.ino: In function ‘void loop()’:
user_define_function_to_blink_LED:26: error: too few arguments to function ‘void digitalWrite(uint8_t, uint8_t)’
byte blinkLed = digitalWrite(ledPin);
^
In file included from sketch\user_define_function_to_blink_LED.ino.cpp:1:0:
C:\Users\Ken Burr\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\cores\arduino/Arduino.h:134:6: note: declared here
void digitalWrite(uint8_t, uint8_t);
^
user_define_function_to_blink_LED:27: error: expected ‘,’ or ‘…’ before ‘(’ token
void blinkLed(int digitalWrite(ledPin) {
^
user_define_function_to_blink_LED:33: error: expected ‘)’ before ‘}’ token
}
^
user_define_function_to_blink_LED:33: error: expected initializer before ‘}’ token
exit status 1
too few arguments to function ‘void digitalWrite(uint8_t, uint8_t)’
This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.
user_define_function_to_blink_LED.ino (581 Bytes)