Notifications
Clear all

Too many Nanos??

41 Posts
8 Users
10 Likes
9,313 Views
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  

I must have more than two dozen Nanos in my workshop! Great, you think, until you realise they all look the same. It is worse than trying to keep track of your own quadruplets without tattooing their names on their foreheads.

For a while now I have been using the simplest of tricks to recognise whether I have a Nano, with sketch loaded on it, that I wish to keep.

void setup(){

Serial.begin();

Serial.println("your_sketch_name.ino"); // add this line to all sketches

}

Just plug them in, and read off the sketch name!


   
Quote
Topic Tags
(@dronebot-workshop)
Workshop Guru Admin
Joined: 5 years ago
Posts: 1081
 

That's actually a really great idea!

One, less technical, method would be the one I use for my microSD cards. I have accumulated a lot of them, mostly for Raspberry Pi but also for other boards and adapters. 

I label each one with a 2-character alphanumeric code - i.e. "A1. A2, C7" etc. Two characters are enough for 260 combinations (or 240 if you don't use "O' and "I") and in the small-font mode my label maker produces a sticker tiny enough to mount on a microSD card.  They would also be small enough to stick on a Nano.

I then keep a spreadsheet with the card numbers and what is on them.  

Bill

"Never trust a computer you can’t throw out a window." — Steve Wozniak


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

@dronebot-workshop

I tried to keep a similar inventory but discovered I was just too lazy to maintain it, so I thought this would be an infallible easy option.


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1037
 

@dronebot-workshop

I use the same method as Bill, except I didn't think far enough into the future!  I guess when I reach 99, the next one will be A0!  I'm up to about 30 now, so maybe I have a little while before I need to make the first character a letter.  And so far my spreadsheet has been fairly easy to maintain and has been a real savior in preventing me from destroying the wrong card.

But I like the @pugwash idea for the Arduino code!  That may be implemented today!

 

SteveG


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

Just plug them in, and read off the sketch name!

This is a GREAT idea!  Except I need a bit more information than just the name of the sketch.  Recently I got out some old 433hz transceiver breadboards.  They were actually running code making the lights on the breadboards light up and switching the xmit/recv relay on and off.  But I couldn't find the source code to save my soul.  So I need more than just the sketch name.  I needed the following information, and even that might not have helped,...

Serial.println("your_sketch_name.ino"); // add this line to all sketches 
Serial.println("Source code saved on computer: #4"); 
Serial.println("On partition: Data F:"); 
Serial.println("In directory: /Lost_Forever"); 
Serial.println("Original Creation Date: Last millennium, exact date unknown");

Even with all that information I might not have been able to find it. I might have physically lost it due to a drive failure somewhere along the way.  In the meantime I had to rewrite the sketch from scratch.

Knowing what sketch is on a board is one thing.  Having the source code in hand is another thing entirely.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
stven
(@stven)
Member
Joined: 5 years ago
Posts: 49
 

I like the idea of printing some information to serial monitor to help relocate original source. This is an area where Raspberry pi excels, months later you can still read and edit source files on the SBC. For Arduino, once the code is uploaded, it is effectively ‘gone’. So you need to rely on external source management 


   
ReplyQuote
justinsane
(@justinsane)
Member
Joined: 5 years ago
Posts: 6
 

@dronebot-workshop

Are they just in order? Or does the alpha-numeric mean something? Like does the A represent anything other than you're now on the As? I think with 3 digits it could A0-A99 gives you 100 items in the category of A...


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

@pugwash

Apologies for coming in late to this topic - I only recently joined.

I hit a similar problem a while ago, but to guard against forgetting to change the print statement I developed the following code which prints the ACTUAL file name + compile date & time whatever edits you have made.

// Just print the filename - not the full path
#include <string.h> // not really needed!
#define __FILENAME__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)

void setup() {
//
// Print filename
//
Serial.begin(9600);
Serial.print("*Source file: ");
Serial.println(__FILENAME__); // Source file name
Serial.print("Compile date: ");
Serial.println(__DATE__);
Serial.print("Compile time: ");
Serial.println(__TIME__);
Serial.println();

// Serial.println(__FILE__); // prints the full path

[From the advice I was given at https://forum.arduino.cc/index.php?topic=427009.msg2942726 ]


   
ZeFerby, Robo Pi and Pugwash reacted
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  

@freddie43

That is an improvement I may adopt in future! Thanks!


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

@freddie43

That's  perfect!   Saves me from having to type in all that information every time.   I'll just put this at the top of all my files from now on.   I especially like the fact that it also gives you the full path so I know where the file was saved on the compute because I have files all over the place. ? 

DroneBot Workshop Robotics Engineer
James


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

By the way, after I  modified the basic file with this additional code I saved it  in "Arduino/examples/01.Basics/BareMinimum/BareMinimum.ino

Now whenever I click on NEW File in the Arduino IDE it just automatically loads this template.   This way it will be in all my future sketches automatically.

DroneBot Workshop Robotics Engineer
James


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

@robo-pi

Nice one!

Thanks for the address - I always wondered where that start up code came from. When I get back home I will do that too - saves a lot of time. Plenty other code and author details can go in there too!

 


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

@robo-pi

Thinks: but does that file get overwritten on every IDE upgrade?


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

Thinks: but does that file get overwritten on every IDE upgrade?

It's possible that it could.   I just now did it so I don't know what any long-term effects might be.

I also saved it as BareMinimum.txt as well, in the same directory.  This way if the ino file gets overwritten all I'll need to do delete the new one and copy the *.txt back over to *.ino.  ? 

I also use multiple computers, so I'll need to update those as well.   But I think in the long haul it's worth it, at least for me.  If I need to open a specific template file every time I'll keep forgetting to do that.  So having it come up automatically when I select  File-New makes it a lot nicer for me.  I'll be more likely to include this in all my sketches.

DroneBot Workshop Robotics Engineer
James


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

@robo-pi

It all looks so easy to edit and change BareMinimum.ino, but Win 10, not content with being a pain in so many other areas, now won't let me remove the 'Read only' tag from the examples folder and save the file there, despite me being the Administrator.

How did you do it?


   
ReplyQuote
Page 1 / 3