Project tutorial
4 bit up/ down counter using 1sheeld

4 bit up/ down counter using 1sheeld © GPL3+

4 bit up down counter that represent every count as binary number on LEDs and display its decimal representation on LCD shield.

  • 3,948 views
  • 1 comment
  • 18 respects

Components and supplies

About this project

Place your 1Sheeld on your Arduino board then plug the Arduino to your laptop or PC.    
Upload your Arduino code and connect the circuit Note : switch 1Sheeld to the Uploading-mode (this is the switch labeled UART Switch on the board) before you upload your sketch to the Arduino board to avoid serial conflicts between 1Sheeld and Arduino, then press the Upload button in the IDE. and once you complete uploading you need to switch 1 shield back to the Operating mode .  
The Connected Circuit 
Connect the App to your shield 
 Open the Gamepad and LCD shields.  
From the Gamepad shield press the Orange button to count up or the red one to count down .Here is an example for Number "1" as a binary representation on LEDS and decimal representation on LCD shield  
Number "10" as a binary representation on LEDS (1010) and decimal representation on LCD shield  


Code

Counter.inoC/C++
/* 
4 bit up down counter that represent every count as binary number on LEDs  and display its decimal representation on LCD shield.
 created by Maha Raafat 
 */

#include <OneSheeld.h>
int count = 0;
void setup()  
 {   
   OneSheeld.begin();
  pinMode(3,OUTPUT);   // declare LED pins as output pins  
  pinMode(4,OUTPUT);  
  pinMode(5,OUTPUT);  
  pinMode(6,OUTPUT);
 }  
 
 void loop()  
 {  
 if (GamePad.isOrangePressed()){
   delay (10);      // for debouncing
  if (GamePad.isOrangePressed()){  
   count ++ ;
  delay(200);
    if((count % 2) > 0) {
    digitalWrite(3, HIGH);
   } 
   else {
    digitalWrite(3, LOW);
     }
 
  if((count % 4) > 1) {
    digitalWrite(4, HIGH);
  } 
  else {
    digitalWrite(4, LOW);
  }

  if((count % 8) > 3) {
    digitalWrite(5, HIGH);
  } 
  else {
    digitalWrite(5, LOW);
  }

  if((count % 16) > 7) {
    digitalWrite(6, HIGH);
  } 
  else {
    digitalWrite(6, LOW);
  }
   LCD.begin();
    LCD.print (count);
  OneSheeld.delay(100);
   
 } 
 }
    if (GamePad.isRedPressed()){  
      delay (10);
    if (GamePad.isRedPressed()){ 
   count -- ;
  delay(200);
    if((count % 2) > 0) {
    digitalWrite(3, HIGH);
   } 
   else {
    digitalWrite(3, LOW);
     }
 
  if((count % 4) > 1) {
    digitalWrite(4, HIGH);
  } 
  else {
    digitalWrite(4, LOW);
  }

  if((count % 8) > 3) {
    digitalWrite(5, HIGH);
  } 
  else {
    digitalWrite(5, LOW);
  }

  if((count % 16) > 7) {
    digitalWrite(6, HIGH);
  } 
  else {
    digitalWrite(6, LOW);
  }
  
   LCD.begin();
  
  
  LCD.print (count);
 
   OneSheeld.delay(100);
   
 
 } 
 }
 }

Schematics

Counter_schema
Capture
Counter_Schema.fzz
4%20bit%20counter.fzz

Comments

Similar projects you might like

Security System With 1Sheeld

Project showcase by nada abdelnaby mady

  • 2,013 views
  • 0 comments
  • 2 respects

4x4x4 LED cube with Arduino Uno and 1sheeld

Project tutorial by Hassan Ibrahim

  • 34,276 views
  • 7 comments
  • 64 respects

ThingSpeak Controlling Arduino with 1Sheeld

by eric

  • 2,753 views
  • 2 comments
  • 4 respects

Controlled Board Eraser using Arduino and 1Sheeld

Project in progress by Mahmoud Ayad

  • 8,768 views
  • 4 comments
  • 34 respects

Line Follower Robot Using Arduino & 1Sheeld

Project tutorial by Ashraf Nabil

  • 3,244 views
  • 0 comments
  • 7 respects

Analog Clock using 1Sheeld Graphical LCD

Project tutorial by Ahmed El-Hinidy

  • 2,646 views
  • 0 comments
  • 7 respects
Add projectSign up / Login