# Avoid error in the DeviceConfigure?

**URL:** <https://community.wolfram.com/t/avoid-error-in-the-deviceconfigure/11665>\
**Category:** Questions\
**Tags:** raspberry-pi, connected-devices\
**Created:** [December 11, 2017, 5:40pm UTC](https://community.wolfram.com/t/avoid-error-in-the-deviceconfigure/11665 "2017-12-11T17:40:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jfuentes](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@jfuentes](https://community.wolfram.com/u/jfuentes)\
**Post date:** [December 11, 2017, 5:40pm UTC](https://community.wolfram.com/t/avoid-error-in-the-deviceconfigure/11665/1 "2017-12-11T17:40:48Z")

</div>

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]

```

---

<div class="post-metadata">

**Author:** ![ijohnson](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/ijohnson/32/21468_2.png) [@ijohnson](https://community.wolfram.com/u/ijohnson)\
**Post date:** [December 11, 2017, 9:10pm UTC](https://community.wolfram.com/t/avoid-error-in-the-deviceconfigure/11665/2 "2017-12-11T21:10:01Z")

</div>

Hi Juan,

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

```auto

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);}"|>
          |>
      }
]

```

---

<div class="post-metadata">

**Author:** ![jfuentes](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@jfuentes](https://community.wolfram.com/u/jfuentes)\
**Post date:** [December 20, 2017, 5:14pm UTC](https://community.wolfram.com/t/avoid-error-in-the-deviceconfigure/11665/3 "2017-12-20T17:14:06Z")

</div>

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
