Good,...better hold on to them,...looks like DK is out again
Well everyone must be out working in their gardens,....no more discussions happening,...I'm missing the all the good input.:wavehand:
That is one sweet looking board O2 ! The blue really makes the parts pop. I recognize the top half of the board, but not the lower right. I see you added a RTC :thumbsup: and pins for 18b20"s, but have you added the controller also? What are all the pins at the bottom? I know you can plug fans in, what else does that baby do? :wavehand:---Rick
very serious looking board well done
snip
I know I've said it before, but I feel the need to repeat - they are cracking boards
Thanks O2Surplus
Tim
#include <Wire.h>
int slaveADDR1 = 4;
byte LEDChannel[5] = {3, 5, 6, 9, 10};
unsigned int LEDBrightness[17] = {0, 1, 2, 4, 8, 16, 32, 64, 128, 64, 32, 16, 8, 4, 2, 1, 0};
unsigned int Temp = 0;
void setup()
{
Serial.begin(115200);
Wire.begin(); // join i2c bus (address optional for master)
}
void loop()
{
for (int i=0; i <= 4; i++){
for (int j=0; j <= 16; j++){
writePWM(slaveADDR1,LEDChannel[i],LEDBrightness[j]);
delay(100);
}
getTemp(slaveADDR1);
Serial.print("Temp ");
Serial.println(Temp);
}
}
void writePWM(int ADDR,byte channel,unsigned int PWMLevel)
{
byte c[2];
c[1] = highByte(PWMLevel);
c[2] = lowByte(PWMLevel);
Wire.beginTransmission(ADDR);
Wire.write(channel);
Wire.write(c[1]);
Wire.write(c[2]);
Wire.endTransmission();
}
void getTemp(int ADDR){
byte tempChar;
Wire.requestFrom(ADDR,1);
while(Wire.available())
{
tempChar = Wire.read();
}
Temp = word(0, tempChar);
}
#include <Wire.h>
unsigned int newPWM = 0;
int channel;
byte c[2];
char flag = 'N';
unsigned int temp[4] = {20, 25, 30, 35};
int i = 1;
void setup()
{
Wire.begin(4); // join i2c bus with address #4
Wire.onReceive(receiveEvent); // register event
Wire.onRequest(requestEvent);
Serial.begin(115200); // start serial for output
pinMode(3,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
}
void loop()
{
if (flag == 'Y') {
newPWM = word(c[1],c[2]);
analogWrite(channel, newPWM);
flag = 'N';
}
}
void receiveEvent(int howMany)
{
flag = 'Y';
if (howMany == 3) {
channel = Wire.read();
c[1] = Wire.read();
c[2] = Wire.read();
}
}
void requestEvent()
{
Wire.write(byte lowByte(temp[i]));
i++;
if (i > 3){
i = 0;
}
}