Giter Club home page Giter Club logo

setr-ulpgc's Introduction

Arduino samples

Here you can find samples for Arduino Uno.

Sample 1.1:

You have 8 digit LED display. Digits have such a view:

 ___________________________
/                           \
|      a         Also there |
|     ___        ground pin |
|  f |   |  b    should be. |
|    |___|                  |
|  e | g |  c               |
|    |___|.                 |
|          \                |
|      d    dp (point digit)|
\___________________________/     

Using Arduino IDE, load SAMPLE1.ino on the board. So now you can see algorithm in work. It counts from 0 to 9, then digit point lights on and it goes down from 9 to 0. Reaching 0 loop repeats.

Sample 1.2:

Working idea is similar to SAMPLE1.ino. But we can use serial monitor, which supports commands like :

  • pause on - pauses (freezes) the LED display, but the counter continues counting.
  • pause off - keeps going (unfreeze) the LED display. It unfreezes with a current counter value.
  • delay %time - set time for showing one numeral
  • reset
  • help - show help dialog

Example:

You run pause on, when display showed 8, than you have been waiting for 4 seconds and run pause off. On the display you will see `7.` : during first second counter counts to `9`, second to `9.`, third to `8.` and fourth second `7.`. Running `reset` you will reset the loop, and it will be repeated from 0. By default time = 1000 (1s), so if you will run `delay 500`, it will start working twice faster.

Add your own command:

  • add new enum value in enum LED_CMD (eg. COMMAND)
  • add #define COMMAND_STR "command\0" - max 8 digits
  • add #define VALUE_STR "val\0" - max 4 digits
  • add declaration and implementation for bool check_COMMAND(Command \*)
  • add if(check_COMMAND(cmd)) return; to initCommand
  • add case COMMAND: to switch(cmd->led_cmd) in loop()

setr-ulpgc's People

Contributors

shakandrew avatar

Watchers

 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.