The error I got is:
Sketch uses 2254 bytes (6%) of program storage space. Maximum is 32256 bytes.
Global variables use 107 bytes (5%) of dynamic memory, leaving 1941 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open(): can't open device "/dev/cu.usbmodem1101": No such file or directory
Failed uploading: uploading error: exit status 1
I have not changed any files. All I added was these few lines of code:
lcd.clear();
lcd.setCursor(0, 0);
My full code is:
// include the library code:
#include <LiquidCrystal.h>
// I2C library:
//#include <LiquidCrystal_I2C.h>
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
// I2C: use the line below
// Parameters: LCD address, number of columns = 16, and the number of rows = 2
//LiquidCrystal lcd(0x3F, 16, 2);
void setup() {
// Normal begin statement for LCD requiring the number of columns and rows:
lcd.begin(16, 2); // Direct wire statement
// I2C begin statement:
//lcd.begin(); // I2C statement
// I2C: Turn on the blacklight
//lcd.backlight();
// Print a message to the LCD.
lcd.print("Hello, world!");
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
int count = millis() / 1000;
lcd.print(count);
if (count == 20) {
lcd.clear();
lcd.print("The countdown has");
lcd.setCursor(0, 1);
lcd.print("ended!");
delay(500);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("YAY!");
lcd.setCursor(0, 1);
lcd.println("This is cool!");
}
}
Can anyone help?