I want to have a some leds change color as the direction and pitch changes.
I have wired up an old CMPS10 - Tilt Compensated Compass Module that I have using the following code. It works perfectly on an Arduino UNO but when I move the sketch to an Arduino DUE it stops immediately I provide power to the leds.Up to that point the compass is happily spewing out data. The thing hangs up so badly that It will not reboot without turning off the power to the DUE ( and turning off the Lights)
I am using Fastled 3.20, the IDE is running on Windows 10 and I am using genuine Arduino UNO and DUE. The lights are WS2812B 300 led/m
I have previously run the leds on the DUE using several of the example sketches with no problems.
The CMPS10 is controlled using I2C and I am pretty certain that it is this that is hanging but I do not know why.
I have also tried having the power to the leds on before providing power to the DUE but that does not help.two Arduinos is that the I2c pins are A4 and A5 on the Uno and 20 and 21 od the DUE
The only difference in the wiring of the
#define NUM_LEDS 150
#define DATA_PIN 6
#define ADDRESS 0x60 // Defines address of CMPS10
Wire.begin(); // Conects I2C
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
char pitch; // Stores pitch char used because they support signed value
Wire.beginTransmission(ADDRESS); //starts communication with CMPS10
Wire.write(1); //Sends the register we wish to start reading from
Wire.requestFrom(ADDRESS, 4); // Request 4 bytes from CMPS10
while(Wire.available() < 4); // Wait for bytes to become available
val = Wire.read();
pitch = Wire.read();
intPitch = pitch;
Serial.print(" Pitch “); Serial.println(intPitch);
//Serial.print(” Roll ");Serial.println(roll);