Code Monkey home page Code Monkey logo

switchmachinetest-sketches's Introduction

SwitchMachineTest

The SwitchMachineTest sketch runs on an Arduino-class microcontroller, and communicates via I2C with one or more Arduino-type microcontrollers running the SwitchMachineController sketch. The controller sketch is written to run on an Adafruit Pro Trinket or ItsyBitsy 32u4, and supports up to four switch machines, numbered 0 through 3. For this sketch, all switch machines on all controllers, if connected, are operated together. You can find a sample track layout with two turnouts in the extras directory here.

The test sketch toggles the controllers' outputs periodically between their 'main' and 'diverging' settings. The sketch also supports two momentary normally-open pushbuttons connected between GPIO pins and ground.

  • pin 11: Sends a RESET command to the switch machine controllers.
  • pin 12: Sends a REFRESH command to the switch machine controllers.

More information about the commands recognized by the switch machine controller can be found in the SwitchMachineController sketch's README file at https://github.com/twrackers/SwitchMachineController-sketches/blob/main/README.md

Test Configuration

The test setup uses a STEMTera™, a breadboard with an Arduino UNO compatible processor inside, as a test processor. Mounted in the breadboard space on top is a pair of Adafruit Pro Trinket processors, each programmed with the SwitchMachineController sketch. There is also one or two momentary normally-open pushbuttons between two GPIO pins on the STEMTera and a ground connection.

The STEMTera's I2C pins SDA and SCL are connected to the Pro Trinkets' SDA and SCL pins as well, forming an I2C bus with the STEMTera as the central and the Pro Trinkets as peripherals. Each Pro Trinket uses 3 GPIO pins to set its peripheral I2C address to a value between 0x30 and 0x37. For this setup, I used 0x30 and 0x31.

LEDs are connected to some of the 3-pin output channels of the SwitchMachineController processors, which are connected as [blue, red, green] to monitor [enable, red, black] signals respectively for each channel.

The SwitchMachineTest runs in a loop where it sends commands via I2C to switch all connected controllers' channels to "diverging" state for 1 second, then back to "main" state for 2 seconds, then repeats indefinitely. By pushing either of the connected pushbuttons, "reset" and "refresh" commands can also be sent to the controllers.

Installation

Instructions for installing the SwitchMachineTest sketch can be found in file INSTALL.md in this repository at https://github.com/twrackers/SwitchMachineTest-sketches/blob/main/INSTALL.md.

Dependencies

The SwitchMachineTest sketch uses the following libraries.

switchmachinetest-sketches's People

Contributors

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