Hello, I have a CoDrone from Robolink and want to use VS and PlatformIO to program the Controller. The Controller is Atmel32 processor. Here is the info on installing Codrone:
I’ve have installed the extension and have a small piece of code:
//#include <Arduino.h>
#include <CoDrone.h>
//#include <EEPROM.h>
void setup() {
CoDrone.begin(115200);
CoDrone.pair(Nearest);
CoDrone.takeoff(); //goes up and hovers for 3 seconds
CoDrone.hover(10); //hovers for an additional 2 seconds
CoDrone.land(); //lands the CoDrone
}
void loop()
{
byte bt8 = digitalRead(18);
byte bt4 = digitalRead( 14);
byte bt1 = digitalRead(11);
if(bt1 && bt4 &&!bt8)
{
CoDrone.emergencyStop();
}
}
Here is my platform.ini
[env:ATmega32]
board = ATmega32
platform = atmelavr
framework = arduino
lib_deps =
# Using a library name
CoDrone
# ... or using library Id
909
# ... or depend on a specific version
CoDrone@2.1.1
I’m not sure what to select for the board so I chose Arduino/Genuino Uno
Here is my output of the compilation:
Processing ATmega32 (board: ATmega32; framework: arduino; platform: atmelavr)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/ATmega32.html
PLATFORM: Atmel AVR 1.15.0 > ATmega32
HARDWARE: ATMEGA32 16MHz, 2KB RAM, 31.50KB Flash
PACKAGES: toolchain-atmelavr 1.50400.190710 (5.4.0), tool-avrdude 1.60300.190424 (6.3.0), framework-arduinoavr 4.1.1
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 13 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <CoDrone> 2.1.1
Checking size .pio\build\ATmega32\firmware.elf
Memory Usage -> http://bit.ly/pio-memory-usage
DATA: [===== ] 45.7% (used 935 bytes from 2048 bytes)
PROGRAM: [== ] 21.7% (used 6986 bytes from 32256 bytes)
Configuring upload protocol...
AVAILABLE: arduino
CURRENT: upload_protocol = arduino
Looking for upload port...
Auto-detected: COM9
Uploading .pio\build\ATmega32\firmware.hex
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e9502 (probably m32)
avrdude: reading input file ".pio\build\ATmega32\firmware.hex"
avrdude: writing flash (6986 bytes):
Writing | ################################################## | 100% 1.21s
avrdude: 6986 bytes of flash written
avrdude: verifying flash memory against .pio\build\ATmega32\firmware.hex:
avrdude: load data flash data from input file .pio\build\ATmega32\firmware.hex:
avrdude: input file .pio\build\ATmega32\firmware.hex contains 6986 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.73s
avrdude: verifying ...
avrdude: 6986 bytes of flash verified
avrdude: safemode: Fuses OK (E:FF, H:00, L:00)
avrdude done. Thank you.
======================================================================== [SUCCESS] Took 5.88 seconds ========================================================================
Terminal will be reused by tasks, press any key to close it.
It look like I’m able to upload the code to the Controller, but when I try to run the code, that is, unplug the USB to the Controller, flip the switch on the dip switch, power on the Drone and then connect the Controller with the USB to start the program, which for some reason does not work. The Controller never finishes paring with the Drone.
What could be the problem?
Thank you very much,
Joe