Fri 26, 14.00pm Project Zone: Advanced Arduino Workshop
This time we made two circuits for Multiplexing of LEDs and PWM for an engine control. The Arduino language made the programming part very easy though. Especially the functions analogRead(pin) and analogWrite(pin, value) made the PWM very easy opposed to the effort you have to do in C. The Arduino Language Reference page shows the available functions that make your life easier.
I.e. the to get a (analog) value from a pin and write it to another is done in two lines of Arduino:
sensorValue = analogRead(sensorPin) / 4; // analogRead gives 0 to 1023, want 0 to 255
analogWrite(motorPin, sensorValue); // analogWrite uses 0 to 255
I try to find the code, I had written in C for PWM, that you can see the difference. I would like to have more programming next time for people in the advanced workshop, we spent lot of time with the hardware and not Arduino in particular.