Arduino runtime config


Author: Dave
Date: 02.28.15 - 10:28am



let's say you have an Arduino sketch you want to distribute without hard coding in certain variables that are user configurable. You want to have the user just upload a sketch without needing to edit it, and you have some type of persistent storage such as an SD card or EEprom memory.

So how do you let user configure the sketchat runtime? below is some example code that will start you in the right direction. When the Arduino is first started it will go into a wait loop looking for serial input. If found it will enter a configuration screen allowing the user to set variables. These can then be saved.

you can also find an example of how to use a vb6 GUI app to configure and Arduino at runtime in my Rotary table Project.

int debug = 0;


void setup() { Serial.begin(9600); Serial.println("press any key to enter config..."); while(!Serial.available() && millis() < 4000) ; if( Serial.available() ){ while( Serial.available() ) Serial.read(); Serial.print("entering config:\n debug value = "); while(debug==0){ debug = Serial.parseInt(); delay(200); } Serial.println(debug); } Serial.println("starting..."); }





Comments: (0)

 
Leave Comment:
Name:
Email: (not shown)
Message: (Required)
Math Question: 71 + 22 = ? followed by the letter: D 



About Me
More Blogs
Main Site
Posts:
2023 (2)
     Circuit board holders
     ADT System Retrofit
2019 (1)
     Electronic dividing head
2017 (3)
     Crawl Space Forklift
     Remote Control Snowblower
     Arduino RC motor control
2016 (6)
     Keyboard Emulation
     Arduino w/ win2k
     Arduino Snowblower chute control
     Attic Fan Remote Control
     Robotic Arm
     ATTiny Watchdog
2015 (7)
     ESP-LINK Huzzah
     Arduino Bugs
     Arduino INI library
     Arduino Yun
     long watchdog
     Arduino runtime config
     CNC Rotary table
2014 (1)
     Humidor AutoWater