Notifications
Clear all

Too many Nanos??

41 Posts
8 Users
10 Likes
9,331 Views
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @freddie43

How did you do it?

I right-clicked on the BareMinimum FOLDER.

Then select "Properties" from the pop-up menu

Then select the "Security" tab in the pop-up window

Then select "Edit"

Then I highlighted "Users"  and checked the boxes Full Control and Modify.

Then click "Apply"

and then "OK" your way back out of the whole mess ? 

And now you should be able to modify the files within that directory.

I'm the only  person who  uses my computer so I just left it that way.  But after you  modify the files, if you want to you can go through the procedure again and set it back to where the users can't modify the files again.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
(@freddie43)
Member
Joined: 4 years ago
Posts: 24
 

@robo-pi

Thanks! That works, though in true Win10 tradition it still shows the folder as 'read only'

My new BareMinimum.ino attached...

 


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @freddie43

My new BareMinimum.ino attached...

That's a nice format for creating new programs.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
(@freddie43)
Member
Joined: 4 years ago
Posts: 24
 

@robo-pi

It has helped in the struggle to get the grandson to write readable structured code. Now to get meaningful names for variables! 


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

Many ways to skin a cat 😉
How about this for an alternative?

Header file: "about.h"

#ifndef ABOUT_H
#define ABOUT_H

struct Sketch {
  String sourceFile;
  String compileDate;
  String compileTime;
  
  Sketch() : sourceFile(__FILE__), compileDate(__DATE__), compileTime(__TIME__) {}
     
  String getDetail() {
      return ("Source file: "   + sourceFile  + "\n" + 
"Compile date: " + compileDate + "\n" +
"Compile time: "  + compileTime);     } }; #endif

Your main program file: "default.ino"

#include <EEPROM.h>
#include "about.h"

void setup() {
  Serial.begin(9600);
  
  Sketch aboutSketch;
  EEPROM.put(0, aboutSketch); // Run once, then remove!

  EEPROM.get(0, aboutSketch);
  Serial.println(aboutSketch.getDetail());
 }

void loop() {

 }

This will save program space, and be a permanent feature unless you explicitly wipe it from the EEPROM.


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 

@freddie43,

I've been using the routine you've posted to update all my boards.    It's not only nice having the boards print all this info to the serial monitor but by going over all my boards I'm reorganizing all my software and projects.

I've gone over about 2 dozen different boards and projects.  I probably have about 2 dozen more to go too!

This is good because it's forcing me to find the original programs on my computer.  Then I update those original programs and move them into a better organized directory scheme.   I not only added the routine you've posted to show the file name, date, time and file path (the entire path is part I like the best).  ? But I've also added "Blink" routines to all programs where I'm not using the onboard LED.    In some cases I even have the LED blinking in between other things the board is doing.  There's a couple good reasons for this.  First, if I just plug power into the board I'll be able to instantly see that it's blinking in my own specific pattern.  That tells me that I've updated the board with this new format.     The other reason is that I'm using 5 different types of boards and they all have different pin numbers for the onboard  LED, so I'm refreshing my memory of which pin each board uses for that.

I use the UNO and  MEGA (they are pretty  much the same).   The Blue Pill STM-32.  The Black Pill STM-32, another STM-32 called a "Smart Card", and finally the ESP8266.    So I've been reorganizing all my projects.    

I've even built shelves for the physical boards.  Many of them include breadboards and many other components.

Another trick I'm using is to place simple text files right in the code folder.   And I just copy and past the *.ino filename as the name of the text file that contains its notes.

For example say I have

Blue_Pill_SD_Card_Reader_V2.ino

Then I create right in that same directory:

Blue_Pill_SD_Card_Reader_V2.txt

And there is all my special info concerning that specific project.    This way every sketch has a nice little text file right with it in the same directory that contains all the little special things I might want to keep track of.

I'm going to be really well organized when I'm all done. ? 

This was way over due.  I should have been better organized out of the gate.  But to be honest I had not clue I was going to come this far.  It seems like just yesterday and I first learned  out to write the blink  sketch on the UNO for the first time.  Since then I've been learning more projects than I can keep track of!  Servo motors, Stepper motors, SD card  readers, Radio transceivers, Robot arm controllers, Robot controllers, IMU sensors, IR sensors,  Display controllers, etc, etc, etc.  More projects than I can keep track of.   So it's time to reorganize and having the microcontrollers tell you whats in them and where to find the files for it, is becoming absolutely necessary.

The Funny thing is that this thread is called: Too Many Nanos.  And I don't even own a single Nano. ? 

But I do have dozens of other boards.  I'm addicted to the STM-32 boards.

Anyway, I'm getting organized now! ? 

 

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
(@freddie43)
Member
Joined: 4 years ago
Posts: 24
 

@robo-pi

Glad you found the code useful. I like your txt file idea - it does help keep track of the many variations that occur through the life of projects!

Sounds like you have been busy editing. A pity we didn't both meet up on Arduino Forum three years ago when I posted it there - you could have then have saved me a lot of effort in the meantime by introducing me to BareMinimum.ino! Would you like to post on there?
[ https://forum.arduino.cc/index.php?topic=427009.msg2942726 ]


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  

@robo-pi

The Funny thing is that this thread is called: Too Many Nanos.  And I don't even own a single Nano.

The reason I called this thread "Too many Nanos??" was because I owned about twenty of the little beasts but only three Unos, which I had numbered with a magic marker (US equiv. Sharpie). Which is absolutely impossible on a Nano. I find them far more practical for breadboard prototyping and for meditation. If AZ-Delivery here in Germany is offering 5 Nanos for next to nothing, I buy ten and spend an afternoon soldering on the headers and burning my fingers in a Zen and the Art of Soldering way.

I really appreciate the developments on my initial crude method, especially storing the sketch details in the onboard EEPROM. I wish I had thought of that, myself! ? 


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @freddie43

I like your txt file idea - it does help keep track of the many variations that occur through the life of projects!

Yes, because the text file can contain a lot of information about the entire project, not just the sketch.  In fact, I'll soon be including schematics of the projects in those same directories too.   I used to keep on these things separate.  Sketches in one directory, text notes in another, and schematics in yet another, and so on.  And unfortunately I often gave them different names too so later it was difficult to know which set of notes and schematics were related to any specific sketch. 

Since the Arduino IDE forces us to create a directory for each sketch I figure I may as well just use those folders for everything related to the project.   And just copy the same sketch filenames as well.  This way I'll  know exactly which sketches, notes, and schematics are referencing the exact same project.

I've been wasting too much time searching through directories trying to find all the related data.  But those days are gone.  Now I've finally wised up.   Everything goes in the sketch folder!   And then there's no confusion over which notes and schematics go with a particular sketch.

This comes at the perfect time too because I just bought a new "cloud" drive.  It's actually just an external physical drive next to my computers.   But I'll be backing everything up on that.  So now I'll have a much better organized filing system for all my microcontroller projects.  No more hunting for scattered information.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
(@freddie43)
Member
Joined: 4 years ago
Posts: 24
 

@robo-pi

You have been busy. Interesting idea but not sure it works for me.

When I develop a project I like to expand the file name at each stage so that I can roll back if things go wrong. Trouble is Arduino IDE  creates a new folder for each one so your system won't directly work for me as I would like to include all my notes in one file for each project, and that generally goes in the header of the program.

Anyway, glad my simple idea has helped you bring order into life!

I must look up your devices - I am not familiar with them, having migrated down from Unos to Nanos.


   
ReplyQuote
(@freddie43)
Member
Joined: 4 years ago
Posts: 24
 

@pugwash

I tried little white dots from a correcting pen, but as you say you quickly run out of space on Nanos. I must try your supplier - I  find Nanos addictive!


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @freddie43

Trouble is Arduino IDE  creates a new folder for each one so your system won't directly work for me as I would like to include all my notes in one file for each project, and that generally goes in the header of the program.

I just copy over the old text file and add the updated info.   If all is well I may even delete the older versions entirely.

Posted by: @freddie43

I must look up your devices - I am not familiar with them, having migrated down from Unos to Nanos.

I buy the cheapest ones I can find.  The reason being that I like to have a ton of them around.

Just tonight I ordered 10pcs each of the following:

The "Blue Pill"  or STM32F103C6T8 development board.

And 10pcs of these:

The "Black Pill"  or STM32F103C6T8 development board.

These two boards are almost identical but not quite.

The main physical difference is that the black pill has mounting holes in the four corners so it's nice if you want to bolt it down.  Electrically they are very similar, except the Blue Pill can be run using a 5volt source while the Black Pill needs to have 3.3volts source.  They actually both run on 3.3 volt's but the Blue Pill has a regulator while the Black Pill does not.  They both have about the same 5-volt tolerant pins.

I buy them with the header pins unattached.  This way I can solder them on facing up or down.  Pins facing down is nice for plugging them into a breadboard.  Pins facing up is nice if  you want to use DuPont wires.  

I use a separate FTDI serial board to program them via the serial connections PA9 and PA10.  But you can also load a bootloader onto them if you want to use the USB connector and program them that way.

Another difference is that  the Blue Pill uses pin PC13 for the onboard LED, while the Black Pill uses  pin PB12.  So for some applications they need to have different sketches.   But for the most part they are fairly compatible in their pin-outs.

I like these boards because of their small size.  They also have more memory than an UNO @ 64K.  They run faster at 72MHz, and they have  a lot more IRQ pins.   In fact I think every I/O pin can be used as an IRQ.

So they have a lot of little features.   And they can be had for about $2.00 a piece or less.  So I like to keep a drawer of each on hand.  My drawers were getting low so I just restocked.    

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
(@freddie43)
Member
Joined: 4 years ago
Posts: 24
 

@robo-pi

Are you saying you program them with the Arduino IDE? 

If so, how? Excuse my ignorance!


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @freddie43

Are you saying you program them with the Arduino IDE? 

Yes.  

You need to go to the Boards Manager and  install the STM32F103C8T6 boards.

Once you do that, you'll not only be able to upload programs to these boards, but you'll even be given Example code specific to these boards.  You will need a FTDI Serial UART to program them though.  But you only need this during programming.  So you only need one of these and you can program as many pills as you want.

 

Most programs you write for an UNO can be uploaded to these boards.  You may need to change a few pin assignments.  But other than this many sketches will run on these boards without any special modifications.  There are exceptions and little quirks that you will discover.    For example, sometimes you can get away with using int on the UNO where you may need to use uint16_t on the STM 32 boards because they are 16-bit processors.

So there are some things you need to be aware of.   But overall it's basically the same high-level code.

The assembly language is quite different though, but unless you're writing Assembly Language code you won't need to worry about that.

I love these little boards.  More memory, faster processing, more IRQ pins, and smaller footprint.  They're basically an Arduino Nano on steroids. ? 

Plus they're CHEAP!

I've been buying them from AliExpress and haven't experienced a problem yet.

I'm not trying to encourage anyone else to use these.  But I can't hide my love for them.  ?  ? 

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @freddie43

Are you saying you program them with the Arduino IDE? 

By the way.  I often develop a project on an  UNO or MEGA first.    And then when I'm ready to build the project permanently I'll transfer it over to a Blue or Black Pill.   Like I say, I may need to change a few pin names, or other quirks to satisfy the board requirements.  But overall  the original program is pretty much the same.  

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Page 2 / 3