You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.5 KiB
69 lines
1.5 KiB
/*
|
|
|
|
Sketch uploader / programmer demonstration
|
|
|
|
This demonstration requires a Bare Bones Freeduino or similar
|
|
Arduino-compatible board with an FTDI-USB cable connector.
|
|
|
|
Connect the target board to the programmer connector on
|
|
the Netduino shield.
|
|
|
|
Compile the sketch in Arduino as normal, press reset on the target
|
|
and then run the following command (on one line,
|
|
replace file names and IP):
|
|
|
|
<ARDUINO>/hardware/tools/avr/bin/avrdude
|
|
-C <ARDUINO>/hardware/tools/avr/etc/avrdude.conf
|
|
-pm168 -cstk500v1 -Pnet:192.168.2.105:7
|
|
-D -v -Uflash:w:/tmp/build31431.tmp/Blink_edit.hex:i
|
|
|
|
*/
|
|
|
|
#include "libw5100.h"
|
|
|
|
void setup() {
|
|
/*
|
|
Setup function required by Arduino
|
|
*/
|
|
|
|
// Configure the network device
|
|
SpiConfiguration SPI = SpiConfiguration();
|
|
SPI.begin();
|
|
W5100Device W5100 = W5100Device(PIN_RESET);
|
|
NetworkInterface Network = NetworkInterface(W5100);
|
|
|
|
// You need to customise these to your own environment
|
|
Network.device.setIp(210,55,77,111);
|
|
Network.device.setMask(255,255,255,128);
|
|
Network.device.setGateway(210,55,77,1);
|
|
|
|
Serial.begin(19200);
|
|
|
|
while (1) {
|
|
NetworkConnection conn = Network.listen(7);
|
|
|
|
while (!conn.isConnected()) {
|
|
delay(500);
|
|
}
|
|
|
|
while (conn.isConnected()) {
|
|
if (conn.available()) {
|
|
Serial.print(conn.read(), BYTE);
|
|
}
|
|
|
|
if (Serial.available()) {
|
|
conn.print(Serial.read());
|
|
}
|
|
}
|
|
|
|
conn.close();
|
|
}
|
|
}
|
|
|
|
|
|
void loop() {
|
|
/*
|
|
Loop function required by Arduino
|
|
*/
|
|
}
|