Pages: [1]   Go Down
Author Topic: mArduino Library  (Read 373 times)
0 Members and 1 Guest are viewing this topic.
taipei
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I wrote a mArduino library for Arduino.
mArduino is a simple library for Arduino.
mArduino uses multiple Arduinos and I2C Protocol to expand Arduino's IO capacity.

By using mArduino, master arduino can read and write slave's I/O very straightforwardly.
Master can make slave's LED in a nearly identical manner to writing an arduino sketch,
for example, the following sketch will blink slave's LED:

#include "Wire.h"      // You need to include both Wire.h and mArduino.h
#include "mArduino.h"

const int SLAVE_ADDRESS = 1;
const int ledPin = 13;

void setup()
{
  mArduino();            // join I2C bus as a Master   
  pinMode(SLAVE_ADDRESS, ledPin, OUTPUT); 


void loop() {
  digitalWrite(SLAVE_ADDRESS, ledPin, HIGH);
  delay(100);
  digitalWrite(SLAVE_ADDRESS, ledPin, LOW);
  delay(100);
}

And here is a general slave sketch:

// General_slave.ino
// Refer to master examples for use with this
#include <Wire.h>          // You need to include both Wire.h and mArduino.h
#include "mArduino.h"

const int SLAVE_ADDRESS = 1;

void setup()
{
  mArduino(SLAVE_ADDRESS);    // join I2C bus as a slave with address 1
}

void loop()
{
}

For more information, see:
http://coopermaa2nd.blogspot.com/2011/12/marduino-arduino-i2c.html
Logged

My Arduino study notes:
http://coopermaa2nd.blogspot.com/

taipei
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry I forgot to say where to get the library.

The mArduino library can be downloaded here:

https://github.com/coopermaa/mArduino
Logged

My Arduino study notes:
http://coopermaa2nd.blogspot.com/

Pages: [1]   Go Up
Jump to: