Laser variant 2

const char* MorseTable[] = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
// space, !, “, #, $, %, &, ‘
NULL, “-.-.–“, “.-..-.”, NULL, NULL, NULL, NULL, “.—-.”,
// ( ) * + , – . /
“-.–.”, “-.–.-“, NULL, “.-.-.”, “–..–“, “-….-“, “.-.-.-“, “-..-.”,
// 0 1 2 3 4 5 6 7
“—–“, “.—-“, “..—“, “…–“, “….-“, “…..”, “-….”, “–…”,
// 8 9 : ; < = > ?
“—..”, “—-.”, “—…”, “-.-.-.”, NULL, “-…-“, NULL, “..–..”,
// @ A B C D E F G
“.–.-.”, “.-“, “-…”, “-.-.”, “-..”, “.”, “..-.”, “–.”,
// H I J K L M N O
“….”, “..”, “.—“, “-.-“, “.-..”, “–“, “-.”, “—“,
// P Q R S T U V W
“.–.”, “–.-“, “.-.”, “…”, “-“, “..-“, “…-“, “.–“,
// X Y Z [ \ ] ^ _
“-..-“, “-.–“, “–..”, NULL, NULL, NULL, NULL, “..–.-“,
// ‘ a b c d e f g
NULL, “.-“, “-…”, “-.-.”, “-..”, “.”, “..-.”, “–.”,
// h i j k l m n o
“….”, “..”, “.—“, “-.-“, “.-..”, “–“, “-.”, “—“,
// p q r s t u v w
“.–.”, “–.-“, “.-.”, “…”, “-“, “..-“, “…-“, “.–“,
// x y z { | } ~ DEL
“-..-“, “-.–“, “–..”, NULL, NULL, NULL, NULL, NULL,
};

int dotLength = 500;
int dashLength = dotLength*3;

void setup() {
// put your setup code here, to run once:
pinMode(13, OUTPUT);
Serial.begin(9600);
}

void loop() {
char ch;
if(Serial.available()){
ch = Serial.read();
flashDashDot(MorseTable[ch]);
delay(dotLength*2);
}
}

void flashDashDot(const char * morseCode)
{
int i = 0;
while(morseCode[i] != 0)
{
if(morseCode[i] == ‘.’){
dot();
} else if (morseCode[i] == ‘-‘){
dash();
}
i++;
}
}

void dot()
{
digitalWrite(13, HIGH);
delay(dotLength);
digitalWrite(13, LOW);
delay(dotLength);
}

void dash()
{
digitalWrite(13, HIGH);
delay(dashLength);
digitalWrite(13, LOW);
delay(dotLength);
}

Ultraheli variant 2

Programmis on vead sees, mis tuleb üles leida, et programm töötaks!

// defines pins numbers

const int trigPin = 9;

const int echoPin = 10;

// defines variables

long duration;

int distance;

void setup() {

pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output

pinMode(echoPin, INPUT); // Sets the echoPin as an Input

Serial.begin(9600); // Starts the serial communication

}

void loop() {

// Clears the trigPin

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

// Sets the trigPin on HIGH state for 10 micro seconds

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

// Reads the echoPin, returns the sound wave travel time in microseconds

duration = pulseIn(echoPin, HIGH);

// Calculating the distance

distance= duration*0.034/2;

// Prints the distance on the Serial Monitor

Serial.print(“Distance: “);

Serial.println(distance);

}

Ultraheli variant 1

Programmis on vead sees, mis tuleb üles leida, et programm töötaks!

#define echoPin 2 // attach pin D2 Arduino to pin Echo of HC-SR04

#define trigPin 3 //attach pin D3 Arduino to pin Trig of HC-SR04

// defines variables

long duration; // muutuja helilainete liikumise kestuse jaoks

int distance; // muutuja kauguse mõõtmiseks

void setup() {

  pinMode(trigPin, OUTPUT); // Sets the trigPin as an OUTPUT

  pinMode(echoPin, INPUT); // Sets the echoPin as an INPUT

  Serial.begin(9600); // // Serial Communication is starting with 9600 of baudrate speed

  Serial.println(“Ultrasonic Sensor HC-SR04 Test”); // print some text in Serial Monitor

  Serial.println(“with Arduino UNO R3”);

}

void loop() {

  // Clears the trigPin condition

  digitalWrite(trigPin, LOW);

  delayMicroseconds(2);

  // Sets the trigPin HIGH (ACTIVE) for 10 microseconds

  digitalWrite(trigPin, HIGH);

  delayMicroseconds(10);

  digitalWrite(trigPin, LOW);

  // Reads the echoPin, returns the sound wave travel time in microseconds

  duration = pulseIn(echoPin, HIGH);

  // Calculating the distance

  distance = duration * 0.034/2; // Speed of sound wave divided by 2 (go and back)

  // Displays the distance on the Serial Monitor

  Serial.print(“Distance: “);

  Serial.print(distance);

  Serial.println(” cm”);

}

7 segmendiline element

Võimalik lahenduskäik/programm.

void setup() {

pinMode(4, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);

}

void loop() {
digitalWrite(4, LOW);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
digitalWrite(11, HIGH);
delay(2000);

digitalWrite(4, LOW);
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
digitalWrite(10, LOW);
digitalWrite(11, LOW);
delay(2000);

digitalWrite(4, HIGH);
digitalWrite(6, LOW);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
digitalWrite(11, LOW);
delay(2000);

digitalWrite(4, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
digitalWrite(11, LOW);
delay(2000);

digitalWrite(4, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
digitalWrite(10, LOW);
digitalWrite(11, HIGH);
delay(2000);

digitalWrite(4, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, HIGH);
digitalWrite(11, HIGH);
delay(2000);

digitalWrite(4, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
digitalWrite(10, HIGH);
digitalWrite(11, HIGH);
delay(2000);

digitalWrite(4, LOW);
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
digitalWrite(11, LOW);
delay(2000);

digitalWrite(4, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
digitalWrite(11, HIGH);
delay(2000);

digitalWrite(4, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
digitalWrite(11, HIGH);
delay(2000);

}

Vabakava

Esitlus/ettekanne/plakat/teatrietendus/väitlus/video teemal: Robootika

Õpilane või väike rühm õpilasi valib endale meelepärase teema robootikast ning teeb selle kohta pealkirjas toodu. Teema valiku kriteerium on, et see peab olema robootikast.

Teema läheb lukku peale selle õpetaja juures registreerimist ning leppides kokku tähtaja, millal õpilane või väike rühm õpilasi seda esitleb/kannab ette.

Kõik enne tööd ja/või töö käigus tekkivad küsimused tuleb õpetajale esitada enne töö tähtaega – kas klassis või e-mailiga.

Teema registreerimise tähtaeg: 04.10.2024
Hinde kaal: Kontrolltöö