Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 0:56d5a7ca509d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Jun 16 13:10:04 2010 +0000
@@ -0,0 +1,38 @@
+/**
+ * Program an AVR with an mbed.
+ */
+
+// ATMega328 Datasheet:
+//
+// http://www.atmel.com/dyn/resources/prod_documents/doc8271.pdf
+
+#include "AVR910.h"
+
+LocalFileSystem local("local");
+Serial pc(USBTX, USBRX);
+
+AVR910 mbedISP(p5, p6, p7, p8); //mosi, miso, sclk, nreset.
+
+int main() {
+
+ int success = -1;
+
+ FILE *fp = fopen(PATH_TO_BINARY, "rb");
+
+ if(fp == NULL){
+ pc.printf("Failed to open binary. Please check the file path\n");
+ }
+ else{
+ pc.printf("Binary file opened successfully\n");
+ success = mbedISP.program(fp);
+ fclose(fp);
+ }
+
+ if(success < 0){
+ printf("Programming failed.\n");
+ }
+ else{
+ printf("Programming was successful!\n");
+ }
+
+}