Project

General

Profile

Revision 1941

Modified python script to read from Arduino over serial and write values into a SQLite3 database. Also adjusted the Arduino station code to read from two sensors every five seconds and send the information over serial to the server.

View differences:

cal_sta_station.pde
1
#define NUM_INPUTS 2
1 2

  
3
int input_pins[NUM_INPUTS] = {0,1};  // Input Pin Numbers
4
int input_vals[NUM_INPUTS] = {0,0};
5

  
2 6
void setup() {
3 7
  Serial.begin(9600);    // Actual baud rate appears to be 19200
4 8
}
5 9

  
6 10
void loop() {
7
  Serial.print("ST:Robo\n");
8
  delay(1000);
9
  Serial.print("ST:Club\n");
10
  delay(1000);
11
  Serial.print("ST:Colony\n");
12
  delay(1000);
11
  // Collect data
12
  int i;
13
  for (i = 0; i < NUM_INPUTS; i++) {
14
    input_vals[i] = analogRead(input_pins[i]);
15
  }
16
  
17
  // Send data to Station
18
  for (i = 0; i < NUM_INPUTS; i++) {
19
    Serial.print("ST:");
20
    Serial.print(input_pins[i]);
21
    Serial.print(":");
22
    Serial.print(input_vals[i]);
23
    Serial.print("\n");
24
  }
25
  delay(5000);
13 26
}

Also available in: Unified diff