User manual

079 B11111,
080 };
081
082 int adc_AVG(byte channel)
083 {
084 total= total readings[index];
085 readings[index] = analogRead(channel);
086 total= total + readings[index];
087 index = index + 1;
088 if (index >= numReadings)index = 0;
089 return total / numReadings;
090 }
091
092 void draw_bargraph(byte percent)
093 {
094 byte i, c1, c2;
095
096 lcd.setCursor(0, 1);
097
098 percent = map(percent, 0, 100, 0, 80);
099
100 c1 = percent / 5;
101 c2 = percent % 5;
102
103 for(i = 0; i < c1; ++i)
104 lcd.write(byte(5));
105
106 lcd.write(c2);
107
108 for(i = 0; i < 16 (c1 + (c2 ? 1 : 0)); ++i)
109 lcd.write(byte(0));
110 }
111
112 void setup()
113 {
114 analogWrite(9, 200);
115
116 lcd.createChar(0, MyChar0);
117 lcd.createChar(1, MyChar1);
118 lcd.createChar(2, MyChar2);
119 lcd.createChar(3, MyChar3);
120 lcd.createChar(4, MyChar4);
121 lcd.createChar(5, MyChar5);
122 lcd.begin(16, 2);
123
124 Serial.begin(19200);
125 }
126