Create an IDE with auto pin assignments and code generation.

10 views
Skip to first unread message

Ray Willis

unread,
Mar 27, 2017, 6:44:01 AM3/27/17
to Developers
I may have the time when I get the source code, but someone else may be able to code this faster than me. Here's my idea:
Create a new tab or menu in the IDE. You have to pick the Board you are using in the IDE menu anyways so why not create a drop down list that allows you to select a pin form a drop down list which shows all pins, and what they are (D1 = Digital, D9 = Digital + PWM, A0 = Analog, etc.). Then another menu allows you to decide if that pin is Input, Output, or Both. Then you select a Generate Code button and it creates the constants and void setup() code automatically. Would also be neat to be able to right click in the IDE code area and decide to auto generate the common statements and functions with generic names (if, if-else, switch cases, do, arrays, and a function). This could be great as a teaching point.

If I get the source code, I may try to at least do this for Uno and Nano.

Example 1 (I selected D1, D2, and D3 form the menu and decide I want to do something different for each one, below gets generated):

const int pin1 = D1
const int pin2 = D2
const int pin1 = D3

void setup() {
  pinMode(pin1, OUTPUT); // declare the pin1 as an OUTPUT
  pinMode(pin2, INPUT); // declare pin2 as an INPUT
  // pin3 is both, no declaration required. I decide what to do with it in code
 
}

Example 2 (I auto-generated an IF statement):

if (valueA >= valueB){
/*
*do something here
*replace valueA and B with your variables
*replace test ">=" as needed
*/
}


Example 3 (Auto generate a function):

void functionA(){
//do stuff here.
}

Rob Tillaart

unread,
Mar 27, 2017, 7:37:31 AM3/27/17
to Arduino Developers
I like the first part to have the reference as that is both useful for new and existing programs. Imho a link to a webpage should be sufficient with very little effort.

The generate part is less interesting as writing is almost as fast as generating, especially if you have edited your "Basic/BareMinimum.ino" sketch in the examples folder. By editing that file you can have a lot of code lines to start with, just throw away what you do not use.

Thanks,
Rob
 

--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+unsubscribe@arduino.cc.

Reply all
Reply to author
Forward
0 new messages