So, I wanted to make a stroboscope with a 16x2 display. I'm using the mighty LiquidCrystal library.
30 minutes before it worked fine, but now I get the error message:
Mehrere Bibliotheken wurden für "LiquidCrystal.h" gefunden
Benutzt: C:\Program
exit status 1
'rs' was not declared in this scope
And don't wonder, the first row is german and means: 'More than one library was found for "LiquidCrystal.h"
Used: C:Programs(x86)'
Also, here is the code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
int period = 500 ;
unsigned long time_now = 0;
/*
* Frequency and Duty controlable Stroboscope - LCD Feedback
*
* Gamesnic
*/
#define mosfet 13 //MOSFET gate on digital pin 13
#define pot A0 //wiper from potentiometer on analog pin 0
#define pot1 A1
int wait = 0; //delay times for Duty and Frequency
int wait1 = 1;
void setup() {
pinMode(13,OUTPUT); //digital pin 13 set for output
pinMode(A0,INPUT); //analog pin 0 set for input
pinMode(A1,INPUT); //analog pin 1 set for input
Serial.begin(250000); //begin serial communication
lcd.begin(16, 2); //begin LCD
lcd.setCursor(2, 0);
lcd.write("Initializing"), lcd.setCursor(4, 1), lcd.write("system ");
delay(333);
lcd.write("Initializing"), lcd.setCursor(4, 1), lcd.write("system. ");
delay(333);
lcd.write("Initializing"), lcd.setCursor(4, 1), lcd.write("system.. ");
delay(333);
lcd.write("Initializing"), lcd.setCursor(4, 1), lcd.write("system... ");
delay(333);
lcd.write("Initializing"), lcd.setCursor(4, 1), lcd.write("system ");
delay(333);
lcd.write("Initializing"), lcd.setCursor(4, 1), lcd.write("system. ");
delay(333);
lcd.write("Initializing"), lcd.setCursor(4, 1), lcd.write("system.. ");
delay(333);
lcd.write("Initializing"), lcd.setCursor(4, 1), lcd.write("system... ");
delay(333);
lcd.write("Loading"), lcd.setCursor(3, 1), lcd.write("Oscillator. ");
delay(333);
lcd.write("Loading"), lcd.setCursor(3, 1), lcd.write("Oscillator.. ");
delay(333);
lcd.write("Loading"), lcd.setCursor(1, 1), lcd.write("MOSFET system... ");
delay(667);
lcd.write("Loading"), lcd.setCursor(2, 1), lcd.write("Serial Debug ");
delay(333);
lcd.write("Loading"), lcd.setCursor(2, 1), lcd.write("Serial Debug. ");
delay(333);
lcd.write("Loading"), lcd.setCursor(2, 1), lcd.write("Serial Debug.. ");
delay(50);
lcd.write("Loading"), lcd.setCursor(1, 1), lcd.write("PWM Modulator... ");
delay(283);
lcd.write("Loading"), lcd.setCursor(1, 1), lcd.write("PWM Modulator ");
delay(333);
lcd.clear();
lcd.setCursor(4, 0), lcd.write("Loading "), lcd.setCursor(3, 1), lcd.write("complete! ");
delay(1200);
lcd.clear();
delay(1000);
lcd.setCursor(2, 1), lcd.write("Starting OS ");
delay(1500);
lcd.clear();
}
void loop() {
int pRead = analogRead(pot); //begin each loop by reading the position of the pot
int pRead1 = analogRead(pot1);
wait = map(pRead,0,1000,1,200); //map the analog read to a value between 1mS to 200ms
wait1 = map(pRead1,0,1000,1,200);
if(millis() > time_now + period){ //make the display only refresh every 500ms
time_now = millis();
}
lcd.setCursor(0, 0);
lcd.write("Freq: "), lcd.setCursor(7, 0), lcd.write(wait), lcd.setCursor(12, 0), lcd.write("ms ");
lcd.setCursor(0, 1);
lcd.write("Duty: "), lcd.setCursor(7, 1), lcd.write(wait1), lcd.setCursor(12, 1), lcd.write("ms ");
digitalWrite(mosfet,HIGH); //flash the MOSFET
delay(wait1); //wait for the Frequency time
digitalWrite(mosfet,LOW); //shut off the MOSFET
delay(wait); //wait for the Duty time
}
Also all of that lcd. stuff in void setup is just for fanciness, has nothing to do with the code.