Giter VIP home page Giter VIP logo

xpressnet_arduino's Introduction

Introduction
=============
This is a basic xpressnet arduino implementation.
My goal was to create my own switch remote controller, so it implements only what I was looking for, but it is very easy to add features.
There is video (in french) of what I'm trying to do at http://youtu.be/JcD7iC3VbOw

Arduino Mega
============
You need an Arduino Mega 2560. Why? because xpressnet is a 9bit serial protocol. Standard Arduino SDK don't provide 9bits. But someone reimplement a 9bit Serial library (I put it into the arduinoSdk directory).
So you need to take HardwareSerial.h and HardwareSerial.cpp and replace these in the Arduino SDK (in /hardware/arduino/avr/cores/arduino/), and of course select Arduino 2560 in the Arduino IDE (in Tools/Board)

Wiring
======
You will need a Max485cpa chip, and pay attention to the wiring image provided. I'm a bit confused on the RJ12 where is the GND and where is the VCC. Also, there is a sense between A and B. If not in the correct position, my program don't decode it properly (I guess bits arrived in the reverse state, i.e. 1 is seen as 0 and 0 is seen as 1). In brief: I don't have code a "auto-reverse".

Code
====
When everything is in place, you can use the code. Mine currently is used to switch every 2 seconds a turnout (its id on my lockmauss is 38, and in the code, it is 37, because human counts from 1.. and computer begins to count from 0)
The "architecture" is the following:
- decodeXpressnet will read on a serial device data coming from xpressnet (via rs485), and will use decodeStage2 to decode data payload.
- if it is a "normal inquiry" message, poolEvent() will be called.
- poolEvent will check the XpressCommand stack state. If there is something, it will pop up one XpressCommand from the stack and send it.
- in your other part of the code, when you want to emit a command, you need to
 * create it: XpressCommand c = new XpressCommand()
 * populate it : c->pushData(0x21); c->pushData(0x81);
 * put it on the queue: XpressCommand::pushStackCommand(stack,c);



Hope it can help!


Nicolas Zin ([email protected])

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.