Ich habe Probleme mit der Anzeige des seriellen Monitors auf einem LCD. Ich bekomme keinen Fehler und das LCD leuchtet auf, so dass ich glaube, dass ich es falsch verkabelt habe. Ich kann den seriellen Monitor/Plotter öffnen und so meine andere Komponente zu ändern in Informationen siehe auch funktioniert so das Problem in dem Code sein muss ...Benötigen Sie Hilfe Anzeige des seriellen Monitors auf LCD
#include <LiquidCrystal.h>
/**
* LIDARLite I2C Example
* Author: Garmin
* Modified by: Shawn Hymel (SparkFun Electronics)
* Date: June 29, 2017
*
* Read distance from LIDAR-Lite v3 over I2C
*
* See the Operation Manual for wiring diagrams and more information:
* http://static.garmin.com/pumac/LIDAR_Lite_v3_Operation_Manual_and_Technical_Specifications.pdf
*/
#include <Wire.h>
#include <LIDARLite.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
// Globals
LIDARLite lidarLite;
int cal_cnt = 0;
void setup()
{
Serial.begin(9600); // Initialize serial connection to display distance readings
lidarLite.begin(0, true); // Set configuration to default and I2C to 400 kHz
lidarLite.configure(0); // Change this number to try out alternate configurations
lcd.begin(16, 2);
// initialize the serial communications:
}
void loop()
{
int dist;
// At the beginning of every 100 readings,
// take a measurement with receiver bias correction
if (cal_cnt == 0) {
dist = lidarLite.distance(); // With bias correction
} else {
dist = lidarLite.distance(false); // Without bias correction
}
// Increment reading counter
cal_cnt++;
cal_cnt = cal_cnt % 100;
// Display distance
Serial.print(dist);
Serial.println(" cm");
delay(10);
// when characters arrive over the serial port...
if (Serial.available()) {
// wait a bit for the entire message to arrive
delay(100);
// clear the screen
lcd.clear();
// read all the available characters
while (Serial.available() > 0) {
// display each character to the LCD
lcd.write(Serial.read());
}
}
}
Das LCD sollte die wechselnden Messungen werden Anzeigen
Der LCD beleuchtet ist, und ich kann die Hintergrundbeleuchtung anpassen, aber ich kann nichts zeigen bekommen.
Es druckt "Test" und was zwei chinesische Symbole zu sein scheint, um das nächste davon. Ich bin nicht sicher, warum es das tut, aber zumindest funktioniert es. Irgendwelche anderen Vorschläge? – User9123