Sorry if the subject line is a bit ... fuzzy. But, today's a perfect example of this issue. All of my hardware is at home, and I have an idea that I need to code up and test. However, there's no way to run a simple test sketch without having an actual board connected. So my question is: is there a way to write a sketch that just does simple serial prints, compile and run it on the local machine without needing to upload it to a board? Sort of a test environment for the AVR?
It probably seems silly to run something that would, technically, require the board to work, but other than having multiple boards, both at home as well as at the office, I can't think of any other way of doing this. All I need is a way to output serial .print()s to the console for testing. Don't need any of the AVR hardware to do anything.
That's no different than me grabbing any of my hardware and carrying it with me. Thing is, we all forget things, and some times I leave things connected to whatever working setup I have. Sure I can spent a few bucks and get another one (and I will probably just do that and leave it at the office.) I was just curious if there was a way to set up an environment for testing.
I know that AS6 has a simulator built in which shows what the pins are doing but I haven't played with it much nor do I know if it allows me to do serial outputs like a normal AVR would.
but other than having multiple boards, both at home as well as at the office, I can't think of any other way of doing this.
Buy another board, maybe a Leo... Leave it at work and consider it your off-site disaster recovery backup! These things are so inexpensive that it will only set you back the price of a couple of hamburger meals.
XD My wife is a coupon freek... sometimes I think I'm going to make cash off of a meal out
I do not normally recommend it on the forum since Arduino makes good use of the profits from the sales of official merchandize, but I have used Chinese clones that are priced under $4 for 16MHz 328's or under $8 with the FTDI chip on board.
Yeah, I've made several application specific clones (with only a few pins broken out), but what I'm doing, which is quite literally writing a test sketch that spits out results to the serial console, I don't need anything broken out to begin with, just the regular FTDI ...
I have an $8 nano-clone attached to a 1-foot miniUSB cable that I use for the same... I call it my sacrificial Nano... I simply do not count the times I download to it... when it dies, I'll bury it with the rest of my eWaste and recyclables like dead batteries!
If what you are doing is so simple that it doesn't need any hardware
and only prints output, then just compile the code you have for the machine you
are using and run it from a terminal window.
In my experience this is seldom the case as the project will need some sort of hardware
or i/o capabilities that requires being run on the actual hardware.
I've actually considered re-writing parts of the AVR GCC lib to just track the register settings and provide a clock for this purpose. In the meantime, I develop libraries with scaffold code that will compile on the CLI.