//滴数計数スケッチ by Kimio Kosaka #include // LCD制御線設定 LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2); int count = 0; int threshold = 70; //液滴通過判定しきい値 void setup() { // LCDの初期設定: lcd.begin(16, 2); // LCDにstartと表示する. lcd.print("start"); } void loop() { // 表示場所を1行0文字にする lcd.setCursor(0, 1); lcd.print(count); //アナログ端子0の値がしきい値以下(液滴なし)の場合は待つ while(analogRead(0)<=threshold); count++; //countの値を1増やす //アナログ端子0の値がしきい値より大(液滴通過中)の場合は待つ while(analogRead(0)>threshold); }