Upload an Arduino Sketch via own Android App and USB cable - arduino

I want to build my own sketch upload app for my Arduino UNO. I have an USB cable which connects my Android smartphone with my UNO. Now I'd like to do something similar to the ArduinoDroid app: Read a .ino file from my Android device, compile and upload it with MY OWN app to the Arduino Board. Can someone give a clue? That would be great, thanks!

So there are 2 tasks here that your Android program will have to perform:
Compile the ino file(s).
Download the compiled program into the Arduino board.
The Arduino IDE uses the gcc/g++ open source compiler to compile the code. It then uses AVRDude to download the compiled source into the Arduino.
Both of these programs run on Linux, which is what Android OS is based upon. Download and install a Linux OS like Ubuntu. Then install gcc & AVRdude on that Linux OS (Google for instructions).
Once you have done that, read up on how to use both programs and play around until you get it working. Then all you have to do is have your Android program execute the same steps to compile and download the Arduino program.
Your Android program will have to somehow package or include the gcc compiler and AVRDude programs. Alternatively, you could send the ino files to a server to be compiled and then receive back the compiled program. Then all you would have to do is download the program into the Arduino.

Related

Should I reinstall nodemcu firmware if I uploaded a arduino sketch?

I have a nodemcu v3 and I'm trying some basic stuff
I installed the esp8266 board in Arduino IDE and then I uploaded a blink example.
But now I'm trying to upload Lua code using ESPLorer but I doesn't work properly. I press in open and set the baud rate to 115200 but I just get some infinite Chinese letters.
Should I reinstall the firmare or something?
There is a very good answers at https://stackoverflow.com/a/43509569/131929 and https://stackoverflow.com/a/47510019/131929.
Should I reinstall the firmare or something?
First you should make up your mind whether you want to conveniently program in Lua or whether you want to stick with Arduino (running on the NodeMCU-clone board). It is an either-or question. Flashing on of them to the module will erase the respective other.
And no, in case you want to use the NodeMCU firmware, you should not use those outdates binaries from 2015. Build a recent version conveniently in the cloud: https://nodemcu.readthedocs.io/en/latest/en/build/.
P.S. if you're interested why I call yours a clone board you may want to read https://frightanic.com/iot/comparison-of-esp8266-nodemcu-development-boards/ from yours truly.
You must erase the flash of your NodeMCU before a new upload. If you ignore that, your software don't run appropriately. To do that, I'm using esptool:
python esptool.py --port COM9: erase_flash
In that example COM9: is the name of my USB/serial interface.
After that you can flash for example your ESP8266 with that line of code to add a boot part:
python esptool.py --port COM9: write_flash -fm dout 0x00000 boot_v1.5.bin
Use the preview line of code and adapt it to upload other parts of the map of the flash memory.

Arduino MKRFox1200 Configuration

I want to install a Arduino MKRFox1200 .
I've installed the drivers,
but i can't find it in the IDE
and even its installed I see this message in the IDE
and this is the result of Get Board Info, but the board is flashing green
You need to install the MKRFox board support package.
Follow the getting started instructions and add the Atmel SAMD Core to your Arduino IDE from the Board Manager.
After you installed it, you should be able to select select the MKRFOX1200 in Tools>Board

How are binaries loaded in the default Arduino bootloader through USB?

I got a desktop program that interfaces with an Arduino.
I need to be sure the correct program, either Processing or pre-compiled AVR binary is loaded as part of my handshake routine with the Arduino.
What are the steps for initializing the download/new program loading procedure on the Arduino Uno R3 with default bootloader?
I want to recreate the upload command found in the IDE.
In the Arduino IDE do this:
Plug the Uno into your computer.
File > Preferences > Show verbose output during: > compilation(uncheck), upload (check) > OK
Select the correct board from the Tools > Board menu
Select the correct port from the Tools > Port menu
Sketch > Upload
After the upload completes resize the black console window at the bottom of the Arduino IDE window and scroll up to the top. You will see the exact AVRDUDE command that was used to upload to the Arduino.
You can copy and adapt that command as needed for use with your program.

Could I upload arduino code to Arduino with VS Code

Is it possible to upload Adruino code to my SODAQ mbili board with VS code and see a serial monitor?
VS code version: 1.6.1
OS version: Windows 10 [Version 10.0.14393]
It seems it possible at least on Ubuntu, but I suppose similar procedure should work on other OS. Instructions and files to download can be found on Github.
The instructions doesn't cover bringing up serial monitor, but you can just download and use any other terminal program, like putty, Realterm, or any other of your choice.

Arduino Mega2560 can't be programmed repeatedly using avrdude

I have a sketch for a mega2560 board that I can upload successfully using the Arduino IDE using the upload button but I would prefer to use a script using avrdude. The only problem is if I try to run avrdude more than once to flash the board it get's a stk500v2_ReceivedMessage(): timeout. It doesn't happen every time but enough. The only way the avrdude seems to work again is if I update the same sketch using the Arduino IDE.
I was having trouble finding what the Arduino IDE does to upload a file but all the settings I could find suggest that avrdude is doing it the same way.
Verbose compilation and upload can be enabled in Arduino IDE Settings:
File->Preferences->Show verbose output during: [] compilation [x] upload.
It will show complete commands used for upload and the avrdude should be same or you can use the same avrdude.exe. You should see something like:
C:\arduino\hardware\tools\avr/bin/avrdude -CC:\arduino\hardware\tools\avr/etc/avrdude.conf -v -V -patmega2560 -cwiring -PCOM17 -b115200 -D -Uflash:w:C:\Users\kiiv\AppData\Local\Temp\build658cdf44885ca2a8676f164a933c092f.tmp/MAX7219_4x4x4.ino.hex:i
BTW: I've just started with PlatformIO CLI (command line tool) and I'm loving it.
PlatformIO IDE didn't work well for me, as I'm using czech keyboard layout and keystrokes prevents me to write all essential characters like []{}#& without switching it to english one.

Resources