Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //zad2
- // include the library code:
- #include <LiquidCrystal.h>
- // initialize the library by associating any needed LCD interface pin
- // with the arduino pin number it is connected to
- const int rs = 8, en = 9, d4 = 4, d5 = 5, d6 = 6, d7 = 7 ;
- LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
- void setup() {
- lcd.begin(16, 2);
- }
- void loop() {
- lcd.setCursor(0,0);
- lcd.print(digitalRead(A0));
- lcd.setCursor(0, 1);
- float voltage = analogRead(A0)*(5.0 / 1023.0);
- lcd.print(voltage);
- lcd.print(" V");
- delay(500);
- lcd.clear();
- }
- //zad3
- #include <LiquidCrystal.h>
- const int rs = 8, en = 9, d4 = 4, d5 = 5, d6 = 6, d7 = 7 ;
- LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
- int incomingByte = 0;
- void setup() {
- Serial.begin(9600);
- }
- void loop() {
- while(Serial.available()>0){
- incomingByte = Serial.read();
- lcd.print((char)incomingByte);
- Serial.print(incomingByte);
- Serial.print(' ');
- delay(1000);
- }
- lcd.clear();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement