Tarkade seadmete ehitamise ring 12.02.24

Robootika ajalugu

Robot 1950

MBOT

Kassid ja lambid

Ehitamise juhendid

Programmeerimine

https://ide.mblock.cc

ARDUINO

Continuous Servo Motor

180 – vastu kellaosuti liikumist

90 – stop

0 – kellaosuti liikumise suunas

#include <Servo.h>

Servo servo;  

void setup() {
  servo.attach(9); // attaches the servo on pin 9 to the servo object
  Serial.begin(9600); // open a serial connection to your computer
}

void loop() {
  Serial.println(servo);

  servo.write(0);
  delay(100);
  servo.write(180);
  delay(100);
}

Programmikood

LEGO EV3

Elevant

LEGO EV3

Tooteliin

Tarkade seadmete ehitamise ring 25.09.23

RUBBISH ROBOT

ARDUINO

Parkimisandur häire ja LED lampidega

#define LED_RED 6
#define LED_YELLOW 5
#define LED_GREEN 3

#define BUZZER 9

#define TRIGGER 10
#define ECHO 11

float average = 0;

void setup() {
  pinMode(LED_RED, OUTPUT);
  pinMode(LED_YELLOW, OUTPUT);
  pinMode(LED_GREEN, OUTPUT);
  pinMode(BUZZER, OUTPUT);
  pinMode(TRIGGER, OUTPUT);
  pinMode(ECHO, INPUT_PULLUP);
  Serial.begin(9600);
}

void loop() {
  int count = 0;
  for (int i = 0; i < 5; i++) {
    float tmp = distance();
    if (tmp != 0 && tmp < 300) {
      average += tmp;
      count++;
    }
    delay(10);
  }
  if (count > 0 && average > 0) {
    average /= count;
    if (average < 250 && average >= 200)
      yellow();
    else if (average < 200 && average > 0)
      red();
    else
      green();
    Serial.print(average);
    Serial.println(" cm");
  } else {
    Serial.println("Ohtu pole :)");
    green();
  }
  average = 0;
}

float distance() {
  digitalWrite(TRIGGER, LOW);
  delayMicroseconds(2);
  digitalWrite(TRIGGER, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIGGER, LOW);
  long duration = pulseIn(ECHO, HIGH, 250000);
  return duration * 0.0343 / 2;
}

void red() {
  digitalWrite(LED_YELLOW, LOW);
  digitalWrite(LED_RED, HIGH);
  digitalWrite(LED_GREEN, LOW);
  tone(BUZZER, 4000);
}

void yellow() {
  digitalWrite(LED_YELLOW, HIGH);
  digitalWrite(LED_RED, LOW);
  digitalWrite(LED_GREEN, LOW);
  noTone(BUZZER);
}

void green() {
  digitalWrite(LED_YELLOW, LOW);
  digitalWrite(LED_RED, LOW);
  digitalWrite(LED_GREEN, HIGH);
  noTone(BUZZER);
}

NEURON

Neuron on loomelabori komplekt, milles on üle 30 erineva funktsionaalsusega elektroonilise ehitusbloki. Nendega saab ehitada erinevaid lahedaid nutividinaid.

Laulev auto

Tarkade seadmete ehitamise ring 11.09.23

MIS ROBOTID NEED ON?

ARDUINO

Arduino on arendusplaat, millega saab erinevaid leiutisi ehitada. Selle külge on võimalik ühendada erinevaid andureid, sisend- ja väljundseadmeid. Programmeeritakse C keeles.

Arduino projektid

LED lambid

CUBROID