arduino_adc_improvement
差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン前のリビジョン | |||
| arduino_adc_improvement [2018/03/31 08:41] – yaasan | arduino_adc_improvement [2018/03/31 08:42] (現在) – yaasan | ||
|---|---|---|---|
| 行 6: | 行 6: | ||
| < | < | ||
| - | if( (millis() - gPreviousL8) >= 200) | + | if( (millis() - gPreviousL8) >= 200) |
| + | { | ||
| + | //Reset task | ||
| + | gPreviousL8 = millis(); | ||
| + | |||
| + | //LED Control | ||
| + | taskLED(); | ||
| + | |||
| + | /* Sensor check */ | ||
| + | aEdc = analogRead(A1); | ||
| + | |||
| + | /* OV check */ | ||
| + | if( aEdc > gThreshold_OV ) | ||
| + | { | ||
| + | aErrNo = 2; | ||
| + | } | ||
| + | /* LV check */ | ||
| + | if( aEdc < gThreshold_LV | ||
| { | { | ||
| - | //Reset task | + | aErrNo |
| - | gPreviousL8 | + | |
| - | //LED Control | + | } |
| - | taskLED(); | + | /* エラー処理 |
| - | + | if( aErrNo > 0) | |
| - | /* Sensor check */ | + | { |
| - | aEdc = analogRead(A1); | + | if( DSCore.IsPower() == 1) |
| - | + | ||
| - | /* OV check */ | + | |
| - | if( aEdc > gThreshold_OV | + | |
| { | { | ||
| - | aErrNo = 2; | + | PowerOffByErr(aErrNo); |
| - | } | + | |
| - | /* LV check */ | + | |
| - | if( aEdc < gThreshold_LV ) | + | |
| - | { | + | |
| - | aErrNo = 1; | + | |
| - | + | ||
| - | } | + | |
| - | /* エラー処理 */ | + | |
| - | if( aErrNo > 0) | + | |
| - | { | + | |
| - | if( DSCore.IsPower() == 1) | + | |
| - | { | + | |
| - | PowerOffByErr(aErrNo); | + | |
| - | } | + | |
| - | + | ||
| } | } | ||
| + | |||
| } | } | ||
| + | } | ||
| </ | </ | ||
| 行 82: | 行 82: | ||
| < | < | ||
| - | if( (millis() - gPreviousL8) >= 200) | + | if( (millis() - gPreviousL8) >= 200) |
| + | { | ||
| + | //Reset task | ||
| + | gPreviousL8 = millis(); | ||
| + | |||
| + | /* Sensor check */ | ||
| + | analogRead_trigger(A1); | ||
| + | |||
| + | //LED Control | ||
| + | taskLED(); | ||
| + | |||
| + | /* Sensor check */ | ||
| + | aEdc = analogRead_get(); | ||
| + | |||
| + | /* OV check */ | ||
| + | if( aEdc > gThreshold_OV | ||
| { | { | ||
| - | //Reset task | + | aErrNo |
| - | gPreviousL8 | + | } |
| - | + | /* LV check */ | |
| - | /* Sensor | + | if( aEdc < gThreshold_LV |
| - | analogRead_trigger(A1); | + | { |
| - | + | aErrNo = 1; | |
| - | //LED Control | + | |
| - | taskLED(); | + | |
| - | /* Sensor check */ | + | } |
| - | aEdc = analogRead_get(); | + | /* エラー処理 |
| - | + | if( aErrNo > 0) | |
| - | /* OV check */ | + | { |
| - | if( aEdc > gThreshold_OV | + | if( DSCore.IsPower() == 1) |
| { | { | ||
| - | aErrNo = 2; | + | PowerOffByErr(aErrNo); |
| - | } | + | |
| - | /* LV check */ | + | |
| - | if( aEdc < gThreshold_LV ) | + | |
| - | { | + | |
| - | aErrNo = 1; | + | |
| - | + | ||
| - | } | + | |
| - | /* エラー処理 */ | + | |
| - | if( aErrNo > 0) | + | |
| - | { | + | |
| - | if( DSCore.IsPower() == 1) | + | |
| - | { | + | |
| - | PowerOffByErr(aErrNo); | + | |
| - | } | + | |
| - | + | ||
| } | } | ||
| + | |||
| } | } | ||
| + | } | ||
| </ | </ | ||
arduino_adc_improvement.1522453312.txt.gz · 最終更新: 2018/03/31 08:41 by yaasan