| home > Tea Ceremony > Prototype | ||
| Tea
Ceremony |
![]() |
|
Prototype 4 pressure sensors with mini-arduino
Click here to download Arduino file >> icm_tea_12042006.zip (49kb) int firstSensor = 0; // first analog sensor
int secondSensor = 0; // second analog sensor
int thirdSensor = 0; // third analog sensor
int fourthSensor = 0; // fourth analog sensor
int inByte = 0; // incoming serial byte
void setup()
{
// start serial port at 9600 bps:
Serial.begin(9600);
}
void loop()
{
// if we get a valid byte, read analog ins:
if (Serial.available() > 0) {
// get incoming byte:
inByte = Serial.read();
// read first analog input, divide by 4 to make the range 0-255:
firstSensor = analogRead(0)/4;
// delay 10ms to let the ADC recover:
delay(10);
// read second analog input, divide by 4 to make the range 0-255:
secondSensor = analogRead(1)/4;
// delay 10ms to let the ADC recover:
delay(10);
// read third analog input, divide by 4 to make the range 0-255:
thirdSensor = analogRead(2)/4;
// delay 10ms to let the ADC recover:
delay(10);
// read fourth analog input, divide by 4 to make the range 0-255:
fourthSensor = analogRead(3)/4;
// send sensor values:
Serial.print(firstSensor, BYTE);
Serial.print(secondSensor, BYTE);
Serial.print(thirdSensor, BYTE);
Serial.print(fourthSensor, BYTE);
}
}
|
||
| Do you want to contact us? Ji Sun Lee, Cho Rong Hwang |
||