Skip to content

Instantly share code, notes, and snippets.

@derekwheee
Created May 20, 2015 02:42
Show Gist options
  • Save derekwheee/6104ced1d0dfbea67f4d to your computer and use it in GitHub Desktop.
Save derekwheee/6104ced1d0dfbea67f4d to your computer and use it in GitHub Desktop.
#include "includes.h"
#include "./Adafruit_NeoPixel.h"
#include "./ws2812.h"
#define I2C_SENSOR_ADDRESS 0x42
#define MAX_RECEIVED_BYTES 16
#include <../../TinyWireS/TinyWireS.h>
#include <avr/power.h>
#include <./SendOnlySoftwareSerial.h>
//SendOnlySoftwareSerial Serial(3);
#define LED_PIN 4
void setup() {
// Set prescaler so CPU runs at 16MHz
if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
// Use TinyWire for ATTINY
TinyWireS.begin(I2C_SENSOR_ADDRESS);
TinyWireS.onReceive(receiveData);
#if _DEBUG
Serial.begin(9600);
Serial.println("NeoPixel I2C");
#endif
ws2812_initialise();
}
void loop() {
// USE this for ATTINY as you can't use delay
TinyWireS_stop_check();
}
void receiveData(uint8_t numbytes) {
byte received_bytes[MAX_RECEIVED_BYTES];
// read the data off the wire and then send it to get parsed.
for (uint8_t i=0; i < numbytes; i++) {
if (i < MAX_RECEIVED_BYTES) {
received_bytes[i] = TinyWireS.receive();
} else {
TinyWireS.receive();
}
}
process_command(numbytes, received_bytes);
#if _DEBUG
Serial.println("\nReceived Data");
Serial.print("Num bytes: ");
Serial.print(numbytes);
Serial.println();
#endif
}
Arduino: 1.6.4 (Mac OS X), Board: "Pro Trinket 5V/16MHz (USB)"
Build options changed, rebuilding all
backpack/Adafruit_NeoPixel.cpp.o: In function `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned int, unsigned char, unsigned char)':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/Adafruit_NeoPixel.cpp:36: multiple definition of `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned int, unsigned char, unsigned char)'
Adafruit_NeoPixel.cpp.o:Adafruit_NeoPixel.cpp:36: first defined here
backpack/Adafruit_NeoPixel.cpp.o: In function `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned int, unsigned char, unsigned char)':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/Adafruit_NeoPixel.cpp:36: multiple definition of `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned int, unsigned char, unsigned char)'
Adafruit_NeoPixel.cpp.o:Adafruit_NeoPixel.cpp:36: first defined here
backpack/Adafruit_NeoPixel.cpp.o: In function `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned int, unsigned char, unsigned char)':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/Adafruit_NeoPixel.cpp:36: multiple definition of `Adafruit_NeoPixel::~Adafruit_NeoPixel()'
Adafruit_NeoPixel.cpp.o:Adafruit_NeoPixel.cpp:36: first defined here
backpack/Adafruit_NeoPixel.cpp.o: In function `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned int, unsigned char, unsigned char)':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/Adafruit_NeoPixel.cpp:36: multiple definition of `Adafruit_NeoPixel::~Adafruit_NeoPixel()'
Adafruit_NeoPixel.cpp.o:Adafruit_NeoPixel.cpp:36: first defined here
backpack/Adafruit_NeoPixel.cpp.o: In function `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned int, unsigned char, unsigned char)':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/Adafruit_NeoPixel.cpp:36: multiple definition of `Adafruit_NeoPixel::begin()'
Adafruit_NeoPixel.cpp.o:Adafruit_NeoPixel.cpp:36: first defined here
backpack/Adafruit_NeoPixel.cpp.o: In function `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned int, unsigned char, unsigned char)':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/Adafruit_NeoPixel.cpp:36: multiple definition of `Adafruit_NeoPixel::show()'
Adafruit_NeoPixel.cpp.o:Adafruit_NeoPixel.cpp:36: first defined here
backpack/Adafruit_NeoPixel.cpp.o: In function `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned int, unsigned char, unsigned char)':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/Adafruit_NeoPixel.cpp:36: multiple definition of `Adafruit_NeoPixel::setPin(unsigned char)'
Adafruit_NeoPixel.cpp.o:Adafruit_NeoPixel.cpp:36: first defined here
backpack/Adafruit_NeoPixel.cpp.o: In function `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned int, unsigned char, unsigned char)':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/Adafruit_NeoPixel.cpp:36: multiple definition of `Adafruit_NeoPixel::setPixelColor(unsigned int, unsigned char, unsigned char, unsigned char)'
Adafruit_NeoPixel.cpp.o:Adafruit_NeoPixel.cpp:36: first defined here
backpack/Adafruit_NeoPixel.cpp.o: In function `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned int, unsigned char, unsigned char)':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/Adafruit_NeoPixel.cpp:36: multiple definition of `Adafruit_NeoPixel::setPixelColor(unsigned int, unsigned long)'
Adafruit_NeoPixel.cpp.o:Adafruit_NeoPixel.cpp:36: first defined here
backpack/Adafruit_NeoPixel.cpp.o: In function `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned int, unsigned char, unsigned char)':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/Adafruit_NeoPixel.cpp:36: multiple definition of `Adafruit_NeoPixel::Color(unsigned char, unsigned char, unsigned char)'
Adafruit_NeoPixel.cpp.o:Adafruit_NeoPixel.cpp:36: first defined here
backpack/Adafruit_NeoPixel.cpp.o: In function `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned int, unsigned char, unsigned char)':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/Adafruit_NeoPixel.cpp:36: multiple definition of `Adafruit_NeoPixel::getPixelColor(unsigned int) const'
Adafruit_NeoPixel.cpp.o:Adafruit_NeoPixel.cpp:36: first defined here
backpack/Adafruit_NeoPixel.cpp.o: In function `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned int, unsigned char, unsigned char)':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/Adafruit_NeoPixel.cpp:36: multiple definition of `Adafruit_NeoPixel::getPixels() const'
Adafruit_NeoPixel.cpp.o:Adafruit_NeoPixel.cpp:36: first defined here
backpack/Adafruit_NeoPixel.cpp.o: In function `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned int, unsigned char, unsigned char)':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/Adafruit_NeoPixel.cpp:36: multiple definition of `Adafruit_NeoPixel::numPixels() const'
Adafruit_NeoPixel.cpp.o:Adafruit_NeoPixel.cpp:36: first defined here
backpack/Adafruit_NeoPixel.cpp.o: In function `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned int, unsigned char, unsigned char)':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/Adafruit_NeoPixel.cpp:36: multiple definition of `Adafruit_NeoPixel::setBrightness(unsigned char)'
Adafruit_NeoPixel.cpp.o:Adafruit_NeoPixel.cpp:36: first defined here
backpack/Adafruit_NeoPixel.cpp.o: In function `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned int, unsigned char, unsigned char)':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/Adafruit_NeoPixel.cpp:36: multiple definition of `Adafruit_NeoPixel::getBrightness() const'
Adafruit_NeoPixel.cpp.o:Adafruit_NeoPixel.cpp:36: first defined here
backpack/Adafruit_NeoPixel.cpp.o: In function `Adafruit_NeoPixel::Adafruit_NeoPixel(unsigned int, unsigned char, unsigned char)':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/Adafruit_NeoPixel.cpp:36: multiple definition of `Adafruit_NeoPixel::clear()'
Adafruit_NeoPixel.cpp.o:Adafruit_NeoPixel.cpp:36: first defined here
backpack/SendOnlySoftwareSerial.cpp.o: In function `SendOnlySoftwareSerial::read()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/SendOnlySoftwareSerial.cpp:143: multiple definition of `SendOnlySoftwareSerial::read()'
SendOnlySoftwareSerial.cpp.o:SendOnlySoftwareSerial.cpp:210: first defined here
backpack/SendOnlySoftwareSerial.cpp.o: In function `SendOnlySoftwareSerial::read()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/SendOnlySoftwareSerial.cpp:143: multiple definition of `SendOnlySoftwareSerial::available()'
SendOnlySoftwareSerial.cpp.o:SendOnlySoftwareSerial.cpp:210: first defined here
backpack/SendOnlySoftwareSerial.cpp.o: In function `SendOnlySoftwareSerial::read()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/SendOnlySoftwareSerial.cpp:143: multiple definition of `SendOnlySoftwareSerial::flush()'
SendOnlySoftwareSerial.cpp.o:SendOnlySoftwareSerial.cpp:210: first defined here
backpack/SendOnlySoftwareSerial.cpp.o: In function `SendOnlySoftwareSerial::read()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/SendOnlySoftwareSerial.cpp:143: multiple definition of `SendOnlySoftwareSerial::peek()'
SendOnlySoftwareSerial.cpp.o:SendOnlySoftwareSerial.cpp:210: first defined here
backpack/SendOnlySoftwareSerial.cpp.o: In function `SendOnlySoftwareSerial::read()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/SendOnlySoftwareSerial.cpp:143: multiple definition of `SendOnlySoftwareSerial::tx_pin_write(unsigned char)'
SendOnlySoftwareSerial.cpp.o:SendOnlySoftwareSerial.cpp:210: first defined here
backpack/SendOnlySoftwareSerial.cpp.o: In function `SendOnlySoftwareSerial::read()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/SendOnlySoftwareSerial.cpp:143: multiple definition of `SendOnlySoftwareSerial::write(unsigned char)'
SendOnlySoftwareSerial.cpp.o:SendOnlySoftwareSerial.cpp:210: first defined here
backpack/SendOnlySoftwareSerial.cpp.o: In function `SendOnlySoftwareSerial::read()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/SendOnlySoftwareSerial.cpp:143: multiple definition of `SendOnlySoftwareSerial::~SendOnlySoftwareSerial()'
SendOnlySoftwareSerial.cpp.o:SendOnlySoftwareSerial.cpp:210: first defined here
backpack/SendOnlySoftwareSerial.cpp.o: In function `SendOnlySoftwareSerial::read()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/SendOnlySoftwareSerial.cpp:143: multiple definition of `SendOnlySoftwareSerial::~SendOnlySoftwareSerial()'
SendOnlySoftwareSerial.cpp.o:SendOnlySoftwareSerial.cpp:210: first defined here
backpack/SendOnlySoftwareSerial.cpp.o: In function `SendOnlySoftwareSerial::read()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/SendOnlySoftwareSerial.cpp:143: multiple definition of `SendOnlySoftwareSerial::setTX(unsigned char)'
SendOnlySoftwareSerial.cpp.o:SendOnlySoftwareSerial.cpp:210: first defined here
backpack/SendOnlySoftwareSerial.cpp.o: In function `SendOnlySoftwareSerial::read()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/SendOnlySoftwareSerial.cpp:143: multiple definition of `SendOnlySoftwareSerial::SendOnlySoftwareSerial(unsigned char, bool)'
SendOnlySoftwareSerial.cpp.o:SendOnlySoftwareSerial.cpp:210: first defined here
backpack/SendOnlySoftwareSerial.cpp.o: In function `SendOnlySoftwareSerial::read()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/SendOnlySoftwareSerial.cpp:143: multiple definition of `SendOnlySoftwareSerial::SendOnlySoftwareSerial(unsigned char, bool)'
SendOnlySoftwareSerial.cpp.o:SendOnlySoftwareSerial.cpp:210: first defined here
backpack/SendOnlySoftwareSerial.cpp.o: In function `SendOnlySoftwareSerial::read()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/SendOnlySoftwareSerial.cpp:143: multiple definition of `SendOnlySoftwareSerial::begin(long)'
SendOnlySoftwareSerial.cpp.o:SendOnlySoftwareSerial.cpp:210: first defined here
backpack/SendOnlySoftwareSerial.cpp.o: In function `SendOnlySoftwareSerial::read()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/SendOnlySoftwareSerial.cpp:143: multiple definition of `SendOnlySoftwareSerial::end()'
SendOnlySoftwareSerial.cpp.o:SendOnlySoftwareSerial.cpp:210: first defined here
backpack/SendOnlySoftwareSerial.cpp.o: In function `SendOnlySoftwareSerial::read()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/SendOnlySoftwareSerial.cpp:143: multiple definition of `SendOnlySoftwareSerial::active_object'
SendOnlySoftwareSerial.cpp.o:SendOnlySoftwareSerial.cpp:210: first defined here
backpack/ws2812.cpp.o: In function `ws2812_initialise()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/ws2812.cpp:10: multiple definition of `ws2812_initialise()'
ws2812.cpp.o:ws2812.cpp:10: first defined here
backpack/ws2812.cpp.o: In function `ws2812_initialise()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/ws2812.cpp:10: multiple definition of `strip'
ws2812.cpp.o:ws2812.cpp:10: first defined here
backpack/ws2812.cpp.o: In function `ws2812_initialise()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/ws2812.cpp:10: multiple definition of `parse_message(String&, int)'
ws2812.cpp.o:ws2812.cpp:10: first defined here
backpack/ws2812.cpp.o: In function `ws2812_initialise()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/ws2812.cpp:10: multiple definition of `show()'
ws2812.cpp.o:ws2812.cpp:10: first defined here
backpack/ws2812.cpp.o: In function `ws2812_initialise()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/ws2812.cpp:10: multiple definition of `process_command(unsigned char, unsigned char*)'
ws2812.cpp.o:ws2812.cpp:10: first defined here
backpack/ws2812.cpp.o: In function `ws2812_initialise()':
/Users/derekwheelden/Documents/Arduino/libraries/backpack/ws2812.cpp:10: multiple definition of `buf'
ws2812.cpp.o:ws2812.cpp:10: first defined here
backpack.cpp.o: In function `receiveData(unsigned char)':
/Users/derekwheelden/backpack.ino:58: undefined reference to `TinyWireS'
/Users/derekwheelden/backpack.ino:58: undefined reference to `TinyWireS'
/Users/derekwheelden/backpack.ino:58: undefined reference to `USI_TWI_S::receive()'
/Users/derekwheelden/backpack.ino:60: undefined reference to `TinyWireS'
/Users/derekwheelden/backpack.ino:60: undefined reference to `TinyWireS'
/Users/derekwheelden/backpack.ino:60: undefined reference to `USI_TWI_S::receive()'
backpack.cpp.o: In function `setup':
/Users/derekwheelden/backpack.ino:29: undefined reference to `TinyWireS'
/Users/derekwheelden/backpack.ino:29: undefined reference to `TinyWireS'
/Users/derekwheelden/backpack.ino:29: undefined reference to `USI_TWI_S::begin(unsigned char)'
/Users/derekwheelden/backpack.ino:30: undefined reference to `TinyWireS'
/Users/derekwheelden/backpack.ino:30: undefined reference to `TinyWireS'
/Users/derekwheelden/backpack.ino:30: undefined reference to `USI_TWI_S::onReceive(void (*)(unsigned char))'
backpack.cpp.o: In function `loop':
/Users/derekwheelden/backpack.ino:47: undefined reference to `TinyWireS_stop_check()'
collect2: error: ld returned 1 exit status
Error compiling.
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment