This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import spacebrew.*; | |
import processing.serial.*; | |
String server = "sandbox.spacebrew.cc"; | |
String name = "PhotoCell_Publisher_" + floor(random(1000)); | |
String description = "This is an example client which publishes the value of a photocell connected to an Arduino "; | |
int bright = 0; // the value of the phtocell we weill send over spacebrew | |
Spacebrew spacebrewConnection; // Spacebrew connection object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
// open serial port | |
Serial.begin(9600); | |
} | |
void loop() { | |
// read and send the value of analog sensor | |
long raw_val = analogRead(A0); | |
// use to adjust the range, if necessary |