GithubHelp home page GithubHelp logo

introductiontorobotics's Introduction

Introduction to Robotics

Learning interesting stuff about robotics.


Homework 1

The code for this homework can be found here.

Task requirements:

  • there will be 3 potentiometers, each of which corresponding to an RGB color
  • gather input from each of the potentiometers
  • properly map the value from a 0-1023 range to a 0-255 range
  • send the converted value to the right output PIN

The set-up:

The video showcasing the functionality can be found here.

Interesting challenges:

  • there is a single 5V pin on the Arduino board and 3 different potentiometers which require a source; then I recalled how a breadboard works and found the solution: to use the + and - columns

Homework 2

The code for this homework can be found here.

The task is to build a simple traffic lights system.

Task requirements:

  • 2 LEDs for people lights
  • 3 LEDs for cars lights
  • 1 buzzer
  • one button

The set-up:

The video showcasing the functionality can be found here.

Clean code thoughts

I was tempted to refactor common logic into separated functions. For instance, I'd encapsulate these lines in a beepBuzzer function:

if (isBuzzerActive) {
  tone(BUZZER_PIN, 1000);
} else {
  noTone(BUZZER_PIN);
}

unsigned long elapsedBuzzerTime = millis() - buzzerStartTimestamp;
if (elapsedBuzzerTime > BUZZER_STATE3_INTERVAL_MS) {
  isBuzzerActive = !isBuzzerActive;
  buzzerStartTimestamp = millis();
}

However, the problem I had encountered was that the function could not be 100% pure. As in, beepBuzzer might need a beepInterval, but 1) it can't be declared in the function's body and 2) the beepInterval might also be different, depending the context the function is used in(i.e. different stages require different intervals). So, I decided that it wasn't worth it.


Homework 3

The code for this homework can be found here.

The set-up:

The video showcasing the functionality can be found here.


Homework 4

The code for this homework can be found here.

The set-up:

The video showcasing the functionality can be found here.


Homework 5

The code for this homework can be found here.

The set-up:

The video showcasing the functionality can be found here.

Useful resources

introductiontorobotics's People

Contributors

andrei0872 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.