Upload sketch with OTA - peno64/ArduinoOTAwiki GitHub Wiki

See example https://github.com/JAndrassy/ArduinoOTA/blob/master/examples/OTEthernet/OTEthernet.ino

  • First upload this example to the arduino mega the standard way via usb.
  • Change the mac if needed.
  • Check in the monitor which ip address is assigned to the arduino.
  • Edit C:\Users\<user>\AppData\Local\Arduino15\packages\my_boards\hardware\avr\programmers.txt and add the ip address
  • In Tools, Board: , choose my_boards-avr (in Sketchbook), Arduino Mega 2560 (Optiboot)
  • In Tools, Programmer:, choose Arduino OTA (ip)
  • Make sure that Serial Monitor is closed!!! If not there is a chance that the arduino is reset too soon and as result a corrupted sketch is flashed. If that happens, you must upload your sketch again via USB.
  • In Sketch, choose Upload Using Programmer

image

image

image

image

image

  • Make sure that the code to make OTA possible is incorporated in your sketch. See the example above. Without that code, OTA is not possible and upload over USB is the only way to upload a new sketch.