Arduino quick start guide
Arduino quick start guide
First configure your Arduino
Create a hardware instrument
Create a hardware instrument
Re: Arduino quick start guide
Great tutorial. It's really easy to get started with Arduino.
Here's my FSX example code for an "Autopilot OFF" LED:
I like that we can control the brightness via software! Now to some encoders...
Here's my FSX example code for an "Autopilot OFF" LED:
Code: Select all
-- Arduino example "Autopliot off"
-- LED will be on for three seconds after autopilot disconnect.
---------------------------------------------------------------
memory_ap = false -- helper variable
led_autopilot=hw_led_add("ARDUINO_MEGA2560_A_D13",0) -- Arduino hardware
function autopilotLight(apMaster)
if not apMaster and memory_ap then -- autopilot from on to off
hw_led_set(led_autopilot,0.5) -- turn on light
memory_ap = false -- clear memory
apoff_timer = timer_start(3000,nil,timer_callback) -- start timer
elseif apMaster then -- when turning autopilot back on
hw_led_set(led_autopilot,0) -- turn off light
memory_ap = true -- memorize
timer_stop(apoff_timer)
end
end
function timer_callback()
hw_led_set(led_autopilot,0) -- turn off light after 3 seconds
end
fsx_variable_subscribe("AUTOPILOT MASTER","bool",autopilotLight)
Re: Arduino quick start guide
A couple of suggestions for the Arduino installation instructions.
First, you need to ensure Windows installs a driver for the Arduino. This is evidently a serial port emulation and it seems to install a virtual COM3 port. For me it appears in Device Manager as 'USB-SERIAL CH340 (COM3)'. This makes sense of the Arduino installer, which asks for a COM port. (The 'getting started' video also tells you to 'verify the COM port', which made no sense until I realised this). I had to force Windows to install a driver for the Arduino by choosing the 'search Windows Update' option when it failed. I note in passing that Windows also detected the Arduino (a Nano) as a 'coprocessor' and couldn't find a device driver for it. This doesn't seem to cause any extra problems. (This is on Windows 7 64 Home Premium, BTW.)
Then for me, the Arduino installer failed with an unhandled exception and a load of complicated error messages. However, I tried it on my main simulator PC (I have AM on a separate PC), which is running Windows 7 Pro 64 and it all worked fine (including the device driver). I noticed that the sim PC had Microsoft .NET Framework 4.7.2 installed, so I went and installed that on the AM PC. Then the Arduino installer then worked and everything checks out in AM.
Maybe that will help some others who are struggling.
First, you need to ensure Windows installs a driver for the Arduino. This is evidently a serial port emulation and it seems to install a virtual COM3 port. For me it appears in Device Manager as 'USB-SERIAL CH340 (COM3)'. This makes sense of the Arduino installer, which asks for a COM port. (The 'getting started' video also tells you to 'verify the COM port', which made no sense until I realised this). I had to force Windows to install a driver for the Arduino by choosing the 'search Windows Update' option when it failed. I note in passing that Windows also detected the Arduino (a Nano) as a 'coprocessor' and couldn't find a device driver for it. This doesn't seem to cause any extra problems. (This is on Windows 7 64 Home Premium, BTW.)
Then for me, the Arduino installer failed with an unhandled exception and a load of complicated error messages. However, I tried it on my main simulator PC (I have AM on a separate PC), which is running Windows 7 Pro 64 and it all worked fine (including the device driver). I noticed that the sim PC had Microsoft .NET Framework 4.7.2 installed, so I went and installed that on the AM PC. Then the Arduino installer then worked and everything checks out in AM.
Maybe that will help some others who are struggling.
Re: Arduino quick start guide
There is also no warning if Air Manager is running and you execute the Arduino installer. The COM port is busy then and it will not work.
-
- Posts: 4726
- Joined: Thu Jul 27, 2017 12:22 am
Re: Arduino quick start guide
I've experienced this many times,
we get at least this kind of messages in the Arduino IDE console like bottom field :
Code: Select all
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "E:\Users\simu\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/etc/avrdude.conf"
Using Port : COM7
Using Programmer : wiring
Overriding Baud Rate : 115200
avrdude: ser_open(): can't open device "\\.\COM7": Access is denied.
avrdude: ser_drain(): read error: The handle is invalid.
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude done. Thank you.
the selected serial port
does not exist or your board is not connected
the Corjan intervention had been a precious help to achieve on this
Regards
Gilles
Re: Arduino quick start guide
Hello everyone,
new to a lot of things here, including Raspberry Pi and Arduino, and so I am struggling trying to figure out what I'm doing wrong.
I have a Raspberry Pi 3b+ that is running AirPlayer. Connectivity to AirManager on my Mac running High Sierra works flawlessly.
I also have an Arduino Mega 2560 that I flashed using the SI installer on one of my Windows machines. When I connect it directly to the Mac, it is recognized without a problem.
My challenge is that when I connect the Arduino to the Raspberry Pi, THEN the Arduino is not being recognized (not showing up in the devices tab) in Air Manager. I can see in Terminal that AirPlayer is recognizing the Arduino:
10-02-2020 22:30:29 INFO HardwareArduino: Mapped channel A to port /dev/ttyACM0
I have searched the forum and the web but haven't been able to find out what might be wrong. Anyone has any clues? Any guidance or advice would be appreciated.
Thanks in advance!
Marco
new to a lot of things here, including Raspberry Pi and Arduino, and so I am struggling trying to figure out what I'm doing wrong.
I have a Raspberry Pi 3b+ that is running AirPlayer. Connectivity to AirManager on my Mac running High Sierra works flawlessly.
I also have an Arduino Mega 2560 that I flashed using the SI installer on one of my Windows machines. When I connect it directly to the Mac, it is recognized without a problem.
My challenge is that when I connect the Arduino to the Raspberry Pi, THEN the Arduino is not being recognized (not showing up in the devices tab) in Air Manager. I can see in Terminal that AirPlayer is recognizing the Arduino:
10-02-2020 22:30:29 INFO HardwareArduino: Mapped channel A to port /dev/ttyACM0
I have searched the forum and the web but haven't been able to find out what might be wrong. Anyone has any clues? Any guidance or advice would be appreciated.
Thanks in advance!
Marco
Re: Arduino quick start guide
The Arduino will not show in the Devices tab when not connected to the machine running AM so what you have is perfectly normal. Have you tried to connect any hardware yet. From the sounds of it, it should work fine.
A point worth noting is the Lua script running the hardware functions must be on the same machine that the hardware is connected to. So in your case upload the instrument that has the hardware functions in it to the Rpi and connect your hardware either directly to the Rpi or via an Arduino that is connected to the Rpi.
I hope that helps. Let us know how you go.
Tony
A point worth noting is the Lua script running the hardware functions must be on the same machine that the hardware is connected to. So in your case upload the instrument that has the hardware functions in it to the Rpi and connect your hardware either directly to the Rpi or via an Arduino that is connected to the Rpi.
I hope that helps. Let us know how you go.
Tony
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Re: Arduino quick start guide
Thanks Tony! I have not yet connected any hardware, as I was stuck trying to "see" the arduino first...
I will try it soon and let you know my progress.
Marco
I will try it soon and let you know my progress.
Marco
-
- Posts: 15
- Joined: Mon Apr 23, 2018 11:28 am
Re: Arduino quick start guide
Hi Guys,
I am having trouble getting my Arduino Mega 2560 and Nano recognised in Air Manager, the odd thing is when running version 3.6 it worked as they appeared under "Actions" in the device tab, and I was on my way to developming by first HW instrument, but I can't seem to get AM to recognise them again followin the upgrade as they are no longer showing up in the Device tab. Here is what I know
1) Both the Mega and Nano flash fine with flash process in AM 3.7 with the "avrdude.exe done. Thank you" message at the end of the session
2) Both are are showing in Device Manager under Ports (COM and LPT) as Ardrino Mega 2560 (COM3) and USB-SERIAL CH340 (COM5) com ports aligned with what was flashed no other errors showing in AM
3) I read another post about Microsoft .NET frramework instalation, I downloaded the installer but I got a message saying there was a later version installed on my system.
4) I ran the simple simple LED flash programme from Arduino sketch and that worked fine on the Mega (then re-flashed the Mega through AM)
I am sure its not related to the 3.7 AM update and I am doing something silly, I have just spent an afternoon trying to get it to work. All other AM functiins are fine, I have written a load of custom guages (specific to Carenado Products) that I will get round to uplooding to the community soon.
My system in Windows 10 64 Pro.
Any help appreciated!
I am having trouble getting my Arduino Mega 2560 and Nano recognised in Air Manager, the odd thing is when running version 3.6 it worked as they appeared under "Actions" in the device tab, and I was on my way to developming by first HW instrument, but I can't seem to get AM to recognise them again followin the upgrade as they are no longer showing up in the Device tab. Here is what I know
1) Both the Mega and Nano flash fine with flash process in AM 3.7 with the "avrdude.exe done. Thank you" message at the end of the session
2) Both are are showing in Device Manager under Ports (COM and LPT) as Ardrino Mega 2560 (COM3) and USB-SERIAL CH340 (COM5) com ports aligned with what was flashed no other errors showing in AM
3) I read another post about Microsoft .NET frramework instalation, I downloaded the installer but I got a message saying there was a later version installed on my system.
4) I ran the simple simple LED flash programme from Arduino sketch and that worked fine on the Mega (then re-flashed the Mega through AM)
I am sure its not related to the 3.7 AM update and I am doing something silly, I have just spent an afternoon trying to get it to work. All other AM functiins are fine, I have written a load of custom guages (specific to Carenado Products) that I will get round to uplooding to the community soon.
My system in Windows 10 64 Pro.
Any help appreciated!
Re: Arduino quick start guide
Be sure that there isn't any other software claiming the Arduino's. Simvim, Mobiflight, Arduino Studio, etc...