Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
wind_sensor:wind_sensor_documentation [2015/12/01 08:33] daisygreen [Implementing Code] |
wind_sensor:wind_sensor_documentation [2015/12/01 10:59] daisygreen [Implementing Code] |
||
---|---|---|---|
Line 147: | Line 147: | ||
figure() | figure() | ||
RT = RTprocess(x',500); | RT = RTprocess(x',500); | ||
- | title('real time process N = 500')<code> | + | title('real time process N = 500') |
+ | end</code> | ||
{{:wind_sensor:input.jpg|}} | {{:wind_sensor:input.jpg|}} | ||
Line 159: | Line 160: | ||
Note: We did a piece wise regression at output<13 and output>13 because if you look above, that is when it changes a lot faster, and we rather avoid an extra power as a feature to decrease residual error and just use 2 models for 2 parts of the fitting. | Note: We did a piece wise regression at output<13 and output>13 because if you look above, that is when it changes a lot faster, and we rather avoid an extra power as a feature to decrease residual error and just use 2 models for 2 parts of the fitting. | ||
+ | The code for collecting data on Arduino is below. This is for collecting analog data before it is processed. This code collects data from all four microphones with a 1 microsecond delay in between readings. Note that each microphone is only being sampled one-fourth of the time. After releasing the reset button on the Arduino, microphone 1 will always be the first data point. | ||
- | </code> | + | <code> |
- | + | ||
- | + | ||
- | // the setup routine runs once when you press reset: | + | |
void setup() { | void setup() { | ||
- | // initialize serial communication at baud bits per second: | ||
Serial.begin(14400); | Serial.begin(14400); | ||
analogReference(EXTERNAL); | analogReference(EXTERNAL); | ||
} | } | ||
- | // the loop routine runs over and over again forever: | ||
void loop() { | void loop() { | ||
| | ||
- | // read the input on analog pin 0: | ||
delayMicroseconds(1); | delayMicroseconds(1); | ||
int sensorValue1 = analogRead(A0); | int sensorValue1 = analogRead(A0); | ||
Line 182: | Line 178: | ||
delayMicroseconds(1); | delayMicroseconds(1); | ||
int sensorValue4 = analogRead(A3); | int sensorValue4 = analogRead(A3); | ||
- | + | ||
- | // print out the value you read: | + | |
- | // After releasing reset button, the first value is always output1 | + | |
Serial.println(sensorValue1); | Serial.println(sensorValue1); | ||
Serial.println(sensorValue2); | Serial.println(sensorValue2); | ||
Line 191: | Line 185: | ||
| | ||
} | } | ||
- | + | end</code> | |
- | + | ||
- | + |
- wind_sensor/wind_sensor_documentation.txt
- Last modified: 2021/09/19 21:59
- (external edit)