Show pageOld revisionsBacklinksBack to top You've loaded an old revision of the document! If you save it, you will create a new version with this data. Media Files ==== an indeterminate sense ==== [[plant sensing]] experiments as part of [[project groworld]] and [[hpi]] === environment === * soil/moisture/light/temperature processing/arduino experiments (see: groworld.git) <code java> ///////////// part of the groworld HPI prototype #include <stdio.h> #define lightpin 1 // light sensor on analog pin 1 #define temppin 0 // humidity sensor on analog pin 0 #define power 8 // power for sensors unsigned long then = 0; // timer which will run for < 50 days unsigned long interval = 1; // interval between reads in seconds ///////////// set up & send void setup() { pinMode(power, OUTPUT); pinMode(temppin, INPUT); pinMode(lightpin, INPUT); Serial.begin(9600); } int lightlevel () { int light = 0; light = (analogRead(lightpin)); return light; } int templevel () { int temp = 0; temp = (analogRead(temppin)); return temp; } ///////////// main loop. sends data to pachube and prints values to serial line char display[64]; void loop() { if (millis() - then > interval*1000) { then = millis(); sprintf(display, "%u,%u,%u\n", (unsigned int)then, lightlevel(), templevel()); Serial.print(display); } } ///////////// </code> === fields === <a href="http://www.flickr.com/photos/foam/3819571687/" title="R0011606 by _foam, on Flickr"><img src="http://farm4.staticflickr.com/3538/3819571687_c99150a7ec.jpg" width="392" height="500" alt="R0011606"></a>Please fill all the letters into the box to prove you're human. Please keep this field empty: SavePreviewCancel Edit summary Note: By editing this page you agree to license your content under the following license: CC Attribution-Share Alike 4.0 International groworld_sensors.1331207598.txt.gz Last modified: 2012-03-08 11:53by nik