Giter Site home page Giter Site logo

shiftregister595's Introduction

ShiftRegister595

Arduino Library for 74HC595 8-bit Shift Register

Description

Library for hardware SN74HC595N SN74HC595 74HC595N 74HC595 DIP-16 Shift Register 8-Bit

Download

ShiftRegister595.zip

Installation guide for Arduino IDE

Install

//Pin 11 ST_CP of 74HC595
#define latchPin D0

//Pin 12 SH_CP of 74HC595
#define clockPin  D1

//Pin 14 DS of 74HC595
#define dataPin  D2

//How many chip are cascade connected
#define numberOfChips 2

constructor ShiftRegister595(numberOfChips, latchPin, clockPin, dataPin);

and begin() in setup function.

Functions

  • begin() - call once in setup function for config pins
  • void write(uint8_t out, uint8_t index) - set specyfic byte of register chain
  • void write(uint8_t out) - you can use for 1 chip
  • void write(uint16_t out) - you can use for 2 chips
  • void write(uint32_t out) - - you can use for 4 chips

Example

/*
 * This is an example of two cascaded chips.
 * uC pins 'latchPin' and 'clockPin' have to connect with all chips (pin-11 and pin-12).
 * 'dataPin' (pin-14) connect only to first chip.
 * Next chip pin-14 connect to Q7' (pin-9) of previous chip.
 *
 * @author Radomir Mazon
 */

#include <ShiftRegister595.h>

//Pin 11 ST_CP of 74HC595
#define latchPin D0

//Pin 12 SH_CP of 74HC595
#define clockPin  D1

//Pin 14 DS of 74HC595
#define dataPin  D2

//How many chip are cascade connected
#define numberOfChips 2

ShiftRegister595 sr595 = ShiftRegister595(numberOfChips, latchPin, clockPin, dataPin);


void setup() {
  sr595.begin();
}


void loop() {
  for (uint16_t j = 0; true; j++) {
    sr595.write(j);
    delay(20);
  }
}

shiftregister595's People

Contributors

radomirmazon 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.