GithubHelp home page GithubHelp logo

benutti / dali2560 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cosino/dali2560

0.0 0.0 0.0 59 KB

The Cosino Mega 2560 DALI implementation

License: GNU General Public License v3.0

Processing 3.62% Makefile 0.07% C++ 71.05% Python 25.26%

dali2560's Introduction

Arduino DALI library for Cosino MEGA 2560

Multi bus DALI master based on a Cosino Mega 2560 board.

This device con control 2 DALI busses.

Prerequisites

To compile the code you need some packages on your Cosino Mega 2560 board and you can use the following command line to install them:

# aptitude install arduino scons make git-core

Then you need the file mega2560.sh to upload your HEX file into the Mega 2560 CPU. It can be downloaded from the URL https://github.com/cosino/cosino.github.io/blob/master/data/extensions/mega_2560/mega2560.sh.

Doing a simple program

An example program can be found in Dali_sketch/Dali_sketch.pde. The code is reported below:

#include <Dali.h>

/*
 * Objects
 */
 
Dali dali0, dali1;

/*
 * Setup
 */
 
void setup()
{
	delay(500);
	Serial.begin(115200);
	
	delay(500);
	Serial.println("DALI testing program - ver. 1.00");
	Serial.println("Cosino Mega 2560 extension");
	Serial.println("Luca Zulberti <[email protected]>");
	
	delay(500);
	dali0.begin(18, 10);	/* Overwrite OC1A and OC1B */
	dali1.begin(A14, A15);	/* Overwrite ADCch 14 and 15 */
}

/*
 * Loop
 */

void loop()
{
	serialDali();
}

As a normal Arduino projects, you can compile and load the sketch into the Mega 2560 CPU with few commands.

From the Cosino Mega 2560 console enter into the main folder and then use the commands below:

# cd Dali_sketch
# make
scons -f ../SConstruct ARDUINO_BOARD=mega2560 \
            EXTRA_LIB=../lib/ -Q
maximum size for hex file: 258048 bytes
scons: building associated VariantDir targets: build
[ ... ]
avr-size --target=ihex Dali_sketch.hex
text    data     bss     dec     hex filename
   0   13028       0   13028    32e4 Dali_sketch.hex

Then use the mega2560.sh to load the HEX file as follow (I supposed you installed the program under the /opt directory):

# /opt/mega2560.sh prog Dali_sketch.hex
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "Dali_sketch.hex"
avrdude: input file Dali_sketch.hex auto detected as Intel Hex
avrdude: writing flash (13028 bytes):

Writing | ################################################## | 100% 1.73s

avrdude: 13028 bytes of flash written

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

Test the simple program

To test the program you can use the screen program (use the usual aptitude command to install it).

screen /dev/ttyS3 115200

In the screen type:

d1000*(CTRL+j)*

This command will turn ON the light at the address 0x00 on bus 0 (see the documentation file protocol.txt).

To turn OFF the device, type:

d0000*(CTRL+j)*

Documentation files

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.