I'm wondering if this is possible. Basically I have an Arduino with the ArduinoISP sketch loaded on it and I want to light up different LEDs connected to the Arduino based on the microcontroller I'm programming. So for example, light up one LED when programming an ATtiny85, another for an ATtiny84, etc.
Do you mean which Arduino board the uploading sketch is intended for, or which type of Arduino is physically attached?
PeterH:
Do you mean which Arduino board the uploading sketch is intended for, or which type of Arduino is physically attached?
Which microcontroller the uploading sketch is intended for.
The protocol between the PC and the AurduinoISP is STK500. This protocol sets various parameters at the start of the upload, including a device code. See table 40 here:
Thanks Peter, looks like I'll be able to get the device code or device signature fairly easily and work with that.
I noticed that the doc you posted only has the device codes / signatures for some of atmel's chips, do you happen to know where I might find a similar doc with more of them? (aside from the individual datasheets of the microcontrollers, it'd just be nice if there was one doc that has a list of them like that one does)
You could use EEPROM on the processors that support it, and load into EEPROM which leds are connected to which pins. You could use a special program to setup the EEPROM for each configuration and then reflash the normal program. Or I believe some setups can use avrdude to read/write the EEPROM.
Another possibility is moving all of your code into a library, and have a class that you initialize with all of the appropriate pins, and call into the library. You would have a different sketch for each combination, but except for setting up the class, and having loop/setup functions that call into the class, everything is in the library.skootles:
do you happen to know where I might find a similar doc with more of them? (aside from the individual datasheets of the microcontrollers, it'd just be nice if there was one doc that has a list of them like that one does)
Just to be clear - I'm not sure this is going to work, I'm only saying that the docs suggest it should be possible. I don't have a list of device codes (I only stumbled over that doc by accident) but if you need to use a code that you don't know you could just write an ArduinoISP variant that told you what device code it had received.