54 lines
1.4 KiB
C++
54 lines
1.4 KiB
C++
/* LED test program
|
|
Alan Marchiori
|
|
Bucknell University
|
|
tested on Rev1.1 HydroSense Wireless Link board
|
|
with PCA9634 on i2c address 0x20
|
|
using a TeensyLC MCU on Arduino 1.0.6 (with Teensyduino installed)
|
|
The teensy uses the library i2c_t3 for i2c communication
|
|
instead of the usual "Wire" library. If using a standard Arduino, you will have
|
|
to manually change the inculdes to use Wire. The libraries should be mostly
|
|
compatible. (some calls are "enhanced" in the i2c_t3 library, these will have
|
|
to be modified appropriately as well).
|
|
*/
|
|
|
|
// set this to the hardware serial port you wish to use
|
|
//#define HWSERIAL Serial1
|
|
#include <Wire.h>
|
|
#include "HydroSense_pca9634.h"
|
|
|
|
//110 1000
|
|
//D0
|
|
|
|
HydroSense_pca9634 leds( 0x68 );
|
|
|
|
void setup() {
|
|
Serial.begin( 115200 );
|
|
Wire.begin();
|
|
Wire.setClock(400000);
|
|
//Wire.begin( I2C_MASTER, 0x00, I2C_PINS_18_19, I2C_PULLUP_EXT, I2C_RATE_1200 );
|
|
leds.begin( );
|
|
for(int i=0; i<8; i++) leds.set_brightness(i, 0);
|
|
}
|
|
|
|
void loop(){
|
|
// for (int i=0; i<=255; i++)
|
|
// {
|
|
// leds.set_brightness(6, i);
|
|
// delay(10);
|
|
// }
|
|
// for (int i=255; i>=0; i--)
|
|
// {
|
|
// leds.set_brightness(6, i);
|
|
// delay(10);
|
|
// }
|
|
// delay(1000);
|
|
|
|
// leds.set_brightness(3, 255);
|
|
for (int i=3; i<=7; i++)
|
|
{
|
|
leds.set_brightness(i, 255);
|
|
delay(1000);
|
|
leds.set_brightness(i, 0);
|
|
}
|
|
}
|