ברוכים הבאים לשיעור השישי!
השיעור מורכב מסדרה של סרטונים, צפו בהם לפי הסדר.
תהנו 🙂
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(A3,INPUT);
pinMode(A4,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.print("A3: ");
Serial.println(digitalRead(A3));
Serial.print("A4: ");
Serial.println(digitalRead(A4));
Serial.println("======");
delay(500);
}
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(A3,INPUT);
pinMode(A4,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.print("A3: ");
Serial.print(digitalRead(A3));
Serial.print(" **** A4: ");
Serial.println(digitalRead(A4));
Serial.println("===========================");
delay(500);
}
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(A6,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.print("A6: ");
Serial.println(analogRead(A6));
if ( (analogRead(A6)>650) && (analogRead(A6)<700) )
Serial.println("GREEN CLICK");
if ( (analogRead(A6)>750) && (analogRead(A6)<800) )
Serial.println("White CLICK");
if ( (analogRead(A6)>800) && (analogRead(A6)<850) )
Serial.println("RED CLICK");
if ( (analogRead(A6)>500) && (analogRead(A6)<550) )
Serial.println("YELLOW CLICK");
if (analogRead(A6)==0)
Serial.println("BLUE CLICK");
delay(500);
}
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(A6,INPUT);
lcd.init();
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("==PlayRobotics==");
lcd.setCursor(4,1);
lcd.print("======");
}
void loop() {
// put your main code here, to run repeatedly:
Serial.print("A6: ");
Serial.println(analogRead(A6));
if ( (analogRead(A6)>650) && (analogRead(A6)<700) )
{
lcd.setCursor(0,1);
lcd.print(" GREEN ");
Serial.println("GREEN CLICK");
}
if ( (analogRead(A6)>750) && (analogRead(A6)<800) )
{
lcd.setCursor(0,1);
lcd.print(" WHITE ");
Serial.println("WHITE CLICK");
}
if ( (analogRead(A6)>800) && (analogRead(A6)<850) )
{
lcd.setCursor(0,1);
lcd.print(" RED ");
Serial.println("GREEN CLICK");
}
if ( (analogRead(A6)>500) && (analogRead(A6)<550) )
{
lcd.setCursor(0,1);
lcd.print(" YELLOW ");
Serial.println("YELLOW CLICK");
}
if (analogRead(A6)==0)
{
lcd.setCursor(0,1);
lcd.print(" BLUE ");
Serial.println("BLUE CLICK");
}
delay(50);
}
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(A7,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(analogRead(A7));
delay(500);
}
if ( (analogRead(A6)>650) && (analogRead(A6)<700) )
{
lcd.setCursor(0,1);
lcd.print(" BEN ");
Serial.println("GREEN CLICK");
}
if ( (analogRead(A6)>750) && (analogRead(A6)<800) )
{
lcd.setCursor(0,1);
lcd.print(" EMILY ");
Serial.println("WHITE CLICK");
}
if ( (analogRead(A6)>800) && (analogRead(A6)<850) )
{
lcd.setCursor(0,1);
lcd.print(" ALEX ");
Serial.println("GREEN CLICK");
}
if ( (analogRead(A6)>500) && (analogRead(A6)<550) )
{
lcd.setCursor(0,1);
lcd.print(" HAGAR ");
Serial.println("YELLOW CLICK");
}
if (analogRead(A6)==0)
{
lcd.setCursor(0,1);
lcd.print(" ");
Serial.println("BLUE CLICK");
}