Message Boards Message Boards

Configuring Arduino Uno R3 board?

Posted 8 years ago

Hi, I want to upload a basic sketch to Arduino Uno R3 board. This is the sketch:

int ON=500;

int OFF=500;

void setup() {

  pinMode(7,OUTPUT);

}

void loop() {

   digitalWrite(7, HIGH);

  delay(ON);

  digitalWrite(7, LOW);

  delay(OFF);

}

This is simple to do with the IDE but how can I do this with Mathematica?

I know the DeviceConfigure command will do it but I have difficulties to do it...

DeviceConfigure[arduino, "Upload" -> "BootFunction" -> <|"Code" -> {
      {"int", "ON" -> 500},
      {"int", "OFF" -> 500},
      {"void", "setup()"},
      {"pinMode(7,OUTPUT)"},
      {"void", "loop()"},
      {"digitalWrite(7,HIGH)"},
      {"delay(ON)"},
      {"digitalWrite(7,LOW)"},
      {"delay(OFF)"}
      }|>]

Thank you for your help.

Marcel Pelletier

POSTED BY: Marcel Pelletier
2 Replies
POSTED BY: Ian Johnson

Hi Ian! Thank you for your help.. In fact, I have a second question to you.

I want to read the temperature "live" from the DHT11 with Mathematica. I also try to upload the Library for this but it is not working.

This is the code:

DeviceConfigure[arduino, "Upload" -> "Libraries" -> "dht.h"]

I know that the name is correct because in the IDE it is OK.
But this not working.

In the IDE, the code is

#include <dht.h>

dht DHT;

#define DHT11_PIN 8

void setup(){
 ...
  Serial.print("Temperature = ");
  Serial.println(DHT.temperature);
  Serial.print("Humidity = ");
  Serial.println(DHT.humidity);

I know now how to do (your first response). How can I configure the Library? Marcel

POSTED BY: Marcel Pelletier
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