Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:Illutron/chaosflow

  • Loading branch information...
commit 6eea1de70d54c974f6dafcfa7ff15b8c24ba609a 2 parents 87f7410 + 0c3055a
@mrbichel mrbichel authored
View
4 README.md
@@ -2,12 +2,14 @@ Abstract data visualization of Copenhagens bike traffic for an installation at t
Get the raw data at http://ge.tt/3mnABAM/v/0
-Install and run mongod:
+Install and run mongodb:
+You can get mongo db using npm. Get node and npm from http://nodejs.org/download/.
$ npm install mongodb
$ mongod --dbpath data-utils/db
Set up a python virtualenv and isntall requirements:
+Get virtualenv and pip from http://www.pip-installer.org/.
$ mkvirtualenv chaosflow
$ pip install -r data-utils/requirements.txt
View
36 arduino/chaos_flowcontrol/chaos_flowcontrol.ino
@@ -1,22 +1,44 @@
+#define CHANNEL_NUM 5
+
int incomingByte = 0; // for incoming serial data
int state = 2; //0 = auto 1 = pending 2 = controlled
long autoDelay = 400;
long lastContact = 0;
-int channels [3];
+int channels [CHANNEL_NUM];
+
+float waterPressure [CHANNEL_NUM];
+boolean waterValveOpen [CHANNEL_NUM];
+boolean airValveOpen [CHANNEL_NUM];
+float airPressure [CHANNEL_NUM];
-float waterPressure [];
+int waterValvePins [CHANNEL_NUM];
+int airValvePins [CHANNEL_NUM];
+int pumpPins [CHANNEL_NUM];
+int airRegulatorPins [CHANNEL_NUM];
// syntax
// 2 W 1.0
-
void setup() {
- Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
-
-
-
+ Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
+
+ waterValvePins[0] = 1;
+ waterValvePins[1] = 2;
+ waterValvePins[2] = 3;
+
+ airValvePins[0] = 1;
+ airValvePins[1] = 2;
+ airValvePins[2] = 3;
+
+ pumpPins[0] = 1;
+ pumpPins[1] = 2;
+ pumpPins[2] = 3;
+
+ airRegulatorPins[0] = 1;
+ airRegulatorPins[1] = 2;
+ airRegulatorPins[2] = 3;
}
void loop() {
View
28 arduino/chaos_flowcontrol/control.ino
@@ -1,26 +1,32 @@
+
void setAirPressure(int channel, float value) {
-// takes channel number and pressure
- //analogWrite();
+ airPressure[channel] = value;
+ analogWrite(airRegulatorPins[channel], map(value, 0, 1, 0, 255));
}
void setWaterPressure(int channel, float value) {
-
+ waterPressure[channel] = value;
+ analogWrite(pumpPins[channel], map(value, 0, 1, 0, 255));
}
-void waterValve() {
-
+void openWater(int channel) {
+ waterValveOpen[channel] = true;
+ digitalWrite(waterValvePins[channel], HIGH);
}
-void closeWater() {
-
+void closeWater(int channel) {
+ waterValveOpen[channel] = false;
+ digitalWrite(waterValvePins[channel], LOW);
}
-void openAir() {
-
+void openAir(int channel) {
+ airValveOpen[channel] = true;
+ digitalWrite(airValvePins[channel], HIGH);
}
-void closeAir() {
-
+void closeAir(int channel) {
+ airValveOpen[channel] = false;
+ digitalWrite(airValvePins[channel], LOW);
}
Please sign in to comment.
Something went wrong with that request. Please try again.