Message Boards Message Boards

Upload photocell sensor data from Arduino Yun Rev 2 to Data Drop?

Posted 5 years ago

Hi All,

I have created a Databin using Data Drop, connected a Arduino Yun Rev 2 to the internet, and created a functional program that queries a photoelectric sensor for a reading and posts the reading to a LCD screen and a laptop screen. Unfortunately I am unable to upload the sensor data from the Yun to Data Drop and would appreciate any insights.

Wolfram's Adruino Yun tutorial suggests including the following code snippet in the Arduino sketch

 //upload to datadrop  
 DatabinRealAdd(\"" <> bin["ShortID"] <>  "\",\"AverageHumidity\",avg);

Prior to adding this code snippet the entire program compiles and runs; after adding it the Arduino IDE highlights the newly added code snippet and gives the following error

stray '\' in program

This is the function that includes the code snippet

void photocellReading() // Photoelectric Sensor Reading
{
  int readPhotocell = analogRead(photoCell);

    if (readPhotocell < 78) // (10,000 lux)(0.00775) = 78 = Full Daylight Reading
    {
      // Show data on LCD shield screen
      lcd.setCursor(0, 0);
      lcd.print("ShadyPlant ");
      lcd.println(readPhotocell);
      lcd.println("");
      delay(timerPrint);             

      // Show data on serial port (laptop screen)
      Serial.print("Shady Plant: ");
      Serial.println(readPhotocell);
      Serial.println("");
      delay(timerPrint);       
    }

    else
    {
      // Show data on LCD shield screen
      lcd.setCursor(0, 0);
      lcd.print("SunnyPlant ");   
      lcd.println(readPhotocell);
      lcd.println("");
      delay(timerPrint);

      // Show data on serial port (laptop screen)        
      Serial.print("Sunny Plant: ");
      Serial.println(readPhotocell);
      Serial.println("");    
      delay(timerPrint);

     // Upload data online using Wolfram Data Drop
     DatabinRealAdd(\"" <> bin["8 character Databin ID"] <>  "\",\"PhotoCellReading\",readPhotocell);           
    }     
}

Editing the code snippet to read

DatabinRealAdd(\"" <> bin["8 character Databin ID"] <>  "\","PhotoCellReading",readPhotocell); 

or to read

DatabinRealAdd("" <> bin["Bsnuo7NG"] <>  "",\"PhotoCellReading\",readPhotocell);  

... again yields the error

stray '\' in program
POSTED BY: Steven Lyell
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