Yes, it is possible to make the Espruino program an Arduino via either ICSP (over SPI) or using the serial bootloader. I don't think anyone's done this, but it's 100% possible. I toyed with the idea of an Espruino program that would let you flash .hex files off the SD card onto an Arduino. However, you can't compile the Arduino code on the Espruino - all you could do is compile sketches ahead of time, and have the Espruino load them onto the Atmel chip. This is useful for making a neat portable programmer for Arduinos, particularly if you need to flash the same thing onto a lot of them, but it's useless for what you're trying to do.
You cannot program a MCU in javascript unless it's running the Espruino firmware, which means an ARM32 chip, not an Atmel chip (an attempt was made to make it run on the mega, but it never worked, and nobody ever bothered to try fixing it).
However - do not despair - there are ways to expand the IO available to an MCU board:
Shift Registers - typically these are 8 or 16 bits, and as you put bits into them over SPI, they spit out the bits they had in them on an output, so you can daisy-chain them - and each bit has an output pin associated with it. These also let you set when the outputs are latched, and let you tri-state the outputs if needed.
I/O expanders - I2C or SPI devices offering both input and output, with widely varying levels of sophistication. You'd have to write a javascript module to control it, since we don't have one ready for any I/O expanders (nobody's used on with the Espruino yet I don't think).
Program an Atmel MCU as an I2C slave, or have it listen on serial, etc, and have it do whatever you want. Of course, you'd have to program this in Arduino-C (or worse still, real C).
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
There are a few questions here:
Yes, it is possible to make the Espruino program an Arduino via either ICSP (over SPI) or using the serial bootloader. I don't think anyone's done this, but it's 100% possible. I toyed with the idea of an Espruino program that would let you flash .hex files off the SD card onto an Arduino. However, you can't compile the Arduino code on the Espruino - all you could do is compile sketches ahead of time, and have the Espruino load them onto the Atmel chip. This is useful for making a neat portable programmer for Arduinos, particularly if you need to flash the same thing onto a lot of them, but it's useless for what you're trying to do.
You cannot program a MCU in javascript unless it's running the Espruino firmware, which means an ARM32 chip, not an Atmel chip (an attempt was made to make it run on the mega, but it never worked, and nobody ever bothered to try fixing it).
However - do not despair - there are ways to expand the IO available to an MCU board:
Shift Registers - typically these are 8 or 16 bits, and as you put bits into them over SPI, they spit out the bits they had in them on an output, so you can daisy-chain them - and each bit has an output pin associated with it. These also let you set when the outputs are latched, and let you tri-state the outputs if needed.
I/O expanders - I2C or SPI devices offering both input and output, with widely varying levels of sophistication. You'd have to write a javascript module to control it, since we don't have one ready for any I/O expanders (nobody's used on with the Espruino yet I don't think).
Program an Atmel MCU as an I2C slave, or have it listen on serial, etc, and have it do whatever you want. Of course, you'd have to program this in Arduino-C (or worse still, real C).