I made a simple wiring like this arduino example.
I wonder if there example code to drive a servomotor with integrated PWM on E310 ?
I tryied to use the default arduino Servo library but it’s sound to be not implemented yet :
WARNING: library Servo claims to run on (avr, sam, samd, nrf52, stm32f4) architecture(s) and may be incompatible with your current board which runs on (riscv) architecture(s).
In file included from /tmp/arduino_modified_sketch_606983/Blink.ino:24:0:
/opt/arduino-1.8.5/libraries/Servo/src/Servo.h:73:2: error: #error “This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor.” #error “This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor.”
^~~~~
exit status 1
Error compiling for board HiFive 1.
It’s not a surprise but I wonder if somebody has already tryied to drive Servomotor with HiFive1, to mutualize efforts ?
It doesn’t really answer your question, but my experience of RC servos is that you don’t actually need PWM with them. You just need to send them a pulse with length between about 500 us and 1500 us from time to time … and it really doesn’t matter much whether you do that at 200 Hz or at 20 Hz. A couple of digitalWrite() with a delayMicroseconds() between in your main loop should be fine. (and maybe a short delay() to prevent it being toooo fast)
It’s the same for normal RC plane “ESC” (Electronic Speed Control) units that control the motors. The ESC takes exactly the same input as a normal servo – you plug them in to a servo channel on the radio.
I haven’t done anything with quadcopters. I’d have thought they’d just have four ESC (or a big one with four inputs). But I don’t know. Maybe they do something different.
I did some googling. Seems like it’s basically the same. The only thing is they’re using pulse lengths a lot shorter than 1 mS to get faster response times. That makes sense when the control signal is coming from an on-board autopilot with IMU and PID and stuff, not from a bloke on the ground wiggling his thumbs.
This code works for the Arduino Zero I set up previously but I get the same error as Martoni when I plug in my HiFive 1. Do you have any insight in where I should put my delays to get it working?