Upload Programs to Arduino with Python

Hi, I am currently trying to make a set of Python codes to upload Arduino codes for me. I am not sure if that is possible, but this is what I currently have:

import serial
import os
ser = serial.Serial('/dev/cu.usbmodem141201', 9600)
string = """#include <Stepper.h>
#define STEPS 200
Stepper stepper(STEPS, 11, 9, 10, 8);
void setup() {
void loop() {

Is this possible? I don't have any errors while processing this code, but Arduino does not receive the code, and my motor never turned. I tried using the Arduino app to upload code, and the Arduino code functions perfectly. I believe this means the problems is at the last line of this code. Can anyone help me? Thanks


The code needs to be … compiled…

Change the preferences to be verbose for compiling and upload the blink example and Look at the bottom part of the IDE window when you upload code. You’ll see all the steps and commands required for your board. (Compile, link, upload etc)

Try to find a tutorial explaining what c++ is and the tool chain to go from the files for your program to binary code you can transfer into the flash memory of your arduino (or a computer). It’s not interpreted like Python.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.