Message Boards Message Boards

0
|
9487 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Avoid error in the DeviceConfigure?

Hi, I am trying to connect an Arduino UNO R3 to a Raspberry Pi and do the blink of the led. The device is connected but when I try to configure the sketche I receive the error messages and I coud not figure out where it is the error. Please help me, Juan

DeviceConfigure[ard,  "Upload" -> {Initialization -> "int val = 0;",    "Functions" -> <|
     "BlinkInvert" -> <|"Code" -> "void blink() {pinMode(13,OUTPUT); digitalWrite(13,val); val \
= !val;}"|>,      "BlinkArgument" -> <|"Code" -> "void blink(int pin, int val) {pinMode(pin,OUTPUT); \
digitalWrite(pin,val);}"|>|>}]
KeyExistsQ::invrl: The argument void blink() {pinMode(PIN,OUTPUT); digitalWrite(PIN,val); val = !val;} is not a valid Association or a list of rules.
KeyExistsQ::invrl: The argument void blink(int PIN, int val) {pinMode(PIN,OUTPUT); digitalWrite(PIN,val);} is not a valid Association or a list of rules.
StringJoin::string: String expected at position 1 in void blink() {pinMode(PIN,OUTPUT); digitalWrite(PIN,val); val = !val;}[Code]<>
<>void blink(int PIN, int val) {pinMode(PIN,OUTPUT); digitalWrite(PIN,val);}[Code]

StringJoin::string: String expected at position 3 in void blink() {pinMode(PIN,OUTPUT); digitalWrite(PIN,val); val = !val;}[Code]<><>void blink(int PIN, int val) {pinMode(PIN,OUTPUT); digitalWrite(PIN,val);}[Code]
POSTED BY: Juan Fuentes
2 Replies

Hi Juan,

You need to also specify the argument types to the "BlinkArgument" function, with something like:

DeviceConfigure[ard, 
     "Upload" -> {
           Initialization -> "int val = 0;",
           "Functions" -> <|
                 "BlinkInvert" -> <|"Code" -> "void blink() {pinMode(13,OUTPUT); digitalWrite(13,val); val = !val;}"|>,
                  "BlinkArgument" -> <|"ArgumentTypes"->{Integer,Integer},"Code" -> "void blink(int pin, int val) {pinMode(pin,OUTPUT); digitalWrite(pin,val);}"|>
          |>
      }
]
POSTED BY: Ian Johnson

Hi Ian thanks for your post. I did what you recommended but I still received the following messages:

DeviceConfigure[ard, 
 "Upload" -> {Initialization -> "int val = 0;", 
   "Functions" -> <|
     "BlinkInvert" -> <|
       "Code" -> 
        "void blink() {pinMode(13,OUTPUT); digitalWrite(13,val); val \
= !val;}"|>, 
     "BlinkArgument" -> <|"ArgumentTypes" -> {Integer, Integer}, 
       "Code" -> 
        "void blink(int pin, int val) {pinMode(pin,OUTPUT); \
digitalWrite(pin,val);}"|>|>}]

KeyExistsQ::invrl: The argument void blink() {pinMode(13,OUTPUT); digitalWrite(13,val); val = !val;} is not a valid Association or a list of rules.

StringJoin::string: String expected at position 1 in void blink() {pinMode(13,OUTPUT); digitalWrite(13,val); val = !val;}[Code]<>
<>{Integer,Integer}[Code].

StringJoin::string: String expected at position 3 in void blink() {pinMode(13,OUTPUT); digitalWrite(13,val); val = !val;}[Code]<>
<>{Integer,Integer}[Code].

StringJoin::string: String expected at position 2 in func0arg0=<>Null.

General::stop: Further output of StringJoin::string will be suppressed during this calculation.

CCompilerDriver`CreateObjectFile::cmperr: Compile error: /tmp/arduinocompile2ebb325c0a70497895b29a8474187379/Working-raspberrypi-3219-1996345344-21/SketchTemplate.cpp.c:103:1: error: 'StringJoin' does not name a type
CCompilerDriver`CreateObjectFile::cmperr: Compile error: /tmp/arduinocompile2ebb325c0a70497895b29a8474187379/Working-raspberrypi-3219-1996345344-21/SketchTemplate.cpp.c:104:21: error: expected unqualified-id before '[' token

I followed your answer to the post of Marcel Pelletier. I does not figure out how to modified my notebook, thanking in advance for any suggestion Juan

POSTED BY: Juan Fuentes
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract