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.
main.cpp
00001 /** 00002 * Program an AVR with an mbed. 00003 */ 00004 00005 // ATMega328 Datasheet: 00006 // 00007 // http://www.atmel.com/dyn/resources/prod_documents/doc8271.pdf 00008 00009 #include "AVR910.h" 00010 00011 LocalFileSystem local("local"); 00012 Serial pc(USBTX, USBRX); 00013 00014 AVR910 mbedISP(p5, p6, p7, p8); //mosi, miso, sclk, nreset. 00015 00016 int main() { 00017 00018 int success = -1; 00019 00020 FILE *fp = fopen(PATH_TO_BINARY, "rb"); 00021 00022 if(fp == NULL){ 00023 pc.printf("Failed to open binary. Please check the file path\n"); 00024 } 00025 else{ 00026 pc.printf("Binary file opened successfully\n"); 00027 success = mbedISP.program(fp); 00028 fclose(fp); 00029 } 00030 00031 if(success < 0){ 00032 printf("Programming failed.\n"); 00033 } 00034 else{ 00035 printf("Programming was successful!\n"); 00036 } 00037 00038 }
Generated on Thu Jul 14 2022 22:49:47 by
1.7.2