问题
I have a Raspberry Pi2 running Windows 10. I want to control a servo using PWM (porting some netduino code). There does not appear to be a PWM pin at all on the Pi-> with the possible exception of 12 (GPIO 18). Can someone confirm this?
Thanks
回答1:
Hardware PWM and ADC are not supported right now on RPi2 (Windows IoT). You need some extra circuitry which can generate PWM or record ADC on demand. There some project works available for that.
How you can achieve PWM & ADC on RPi2 + Windows IoT?
RPi2 will be connected to a gateway device via I2C/SPI Bus. A gateway device is nothing more than a microcontroller like Arduino. We need to program gateway to respond RPi2. Gateway device will act as I2C/SPI slave. Whenever RPi2 requests to write specific PWM pin, Gateway will generate PWM for that pin on demand.
Something you might like:
PWM Servo Control (RPi2 + Windows IoT):
https://www.hackster.io/AnuragVasanwala/windows-10-iot-core-ultrasonic-distance-mapper-d94d63
PWM Motor Speed Control & Retrieve ADC (RPi2 + Windows IoT):
https://www.hackster.io/AnuragVasanwala/windows-10-iot-core-hydroflyer-f83190
回答2:
Yes and I doubt it will ever be added to Windows. Windows isn't a "Real Time" OS so it can't make the precise microsecond pulses required for PWM hardware.
Apparently there are breakout boards that could do this (ex: https://www.adafruit.com/products/815)
I haven't tried any yet though.
来源:https://stackoverflow.com/questions/32192412/raspberry-pi2-running-windows-10-no-pwm