I want to know how to write this on the eclipse work-space of the Intel Edison
analogWrite(3, 127);
Thanks in Advance
Hi dunex_1,
The analogWrite() method is used to generate a PWM wave. You could use the MRAA libraries to accomplish this in C/C++. I recommend you to check the following example which shows how to use the PWM with MRAA: https://github.com/intel-iot-devkit/mraa/blob/master/examples/c%2B%2B/Pwm3-cycle.cpp mraa/Pwm3-cycle.cpp at master · intel-iot-devkit/mraa · GitHub
In the following site there is additional documentation about PWM with MRAA: http://iotdk.intel.com/docs/master/mraa/classmraa_1_1_pwm.html mraa: Pwm Class Reference
Regards,
Diego
Hi dunex_1,
The analogWrite() method is used to generate a PWM wave. You could use the MRAA libraries to accomplish this in C/C++. I recommend you to check the following example which shows how to use the PWM with MRAA: https://github.com/intel-iot-devkit/mraa/blob/master/examples/c%2B%2B/Pwm3-cycle.cpp mraa/Pwm3-cycle.cpp at master · intel-iot-devkit/mraa · GitHub
In the following site there is additional documentation about PWM with MRAA: http://iotdk.intel.com/docs/master/mraa/classmraa_1_1_pwm.html mraa: Pwm Class Reference
Regards,
Diego
Hi Diego,
But the pwm pin uses floating numbers in percentage. I want to be able to pass a value of 0 to 255 instead of a duty cycle of 0.0 to 1.0
Thanks
Hi dunex_1,
You could use the map() function to make the conversion from 0-255 to 0.0-1.0. The map() function is easy to program, the description of how it works can be checked in the following site: https://www.arduino.cc/en/Reference/Map Arduino - Map
Regards,
Diego
Hi @ DiegoV_Intel
Thank you for directing me to the path. I have improved my code. Can you look at this thread and reply to it too with any suggestion please!
Thanks in advance!
For more complete information about compiler optimizations, see our Optimization Notice.