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,247 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

4x4x4 LED cube with Arduino Uno and 1sheeld

Project tutorial by Hassan Ibrahim

  • 29,731 views
  • 6 comments
  • 60 respects

ThingSpeak Controlling Arduino with 1Sheeld

by eric

  • 2,447 views
  • 2 comments
  • 4 respects

Security System With 1Sheeld

Project showcase by nada abdelnaby mady

  • 1,385 views
  • 0 comments
  • 2 respects

Controlled Board Eraser using Arduino and 1Sheeld

Project in progress by Mahmoud Ayad

  • 7,521 views
  • 3 comments
  • 32 respects

Universal Remote Control using Arduino, 1Sheeld and Android

Project tutorial by Ashraf Nabil

  • 8,144 views
  • 5 comments
  • 12 respects

Crying Baby Detector Using 1Sheeld

Project tutorial by Kirollos Magdi Sobhy

  • 4,729 views
  • 7 comments
  • 27 respects
Add projectSign up / Login