I recently made a project where output is coming from the differential between data reading and reference value. It works on my Proteus simulation but there is no PWM output on my real world device.
Here is my code listing
for (z = 0; z <= output2; z++)
if (output2 >= 30) {
toggle == HIGH;
en = !en;
}
if (en == true) {
OCR1A = map(z, 0, 255, 0, ICR1); ;
OCR1B = 0;
} else {
OCR1A=0;
OCR1B = map(z, 0, 255, 0, ICR1);
}
if (output2 < 30) {
en = !en;
analogWrite(9, 0);
analogWrite(10, 0);
}
map()? Do you know what OCR1A/B are and how theanalogWrite()function works?