while trying to learn how things work I wrote this little program. I'm on a mac
#include "mbed.h"
// LED1 = P1.18 LED2 = P1.20 LED3 = P1.21 LED4 = P1.23
#define LED_MASK 0x00140000
PortInOut ledport(Port1, LED_MASK);
Serial pcscreen( USBTX,USBRX); // when you start, in terminal type:
// screen /dev/tty.usbmodemfa132
PwmOut myled(LED1);
float brightness =0.5;
LocalFileSystem local("local"); // Create the local filesystem under the name "local"
FILE *fp;
void setup() {
pcscreen.printf("b to make it brighter, d to make it dimmer\n");
ledport=LED_MASK;
fp = fopen("/local/out.txt", "w"); // Open "out.txt" on the local file system for writing
}
void loop ( ) {
myled = brightness;
char c;
c = pcscreen.getc();
if (c == 'b') brightness += 0.02;
if (c == 'd') brightness -= 0.02;
if (c == 'n') ledport.write(LED_MASK);
if (c == 'f') ledport = 0;
if (c == 'q') fclose(fp);
ledport.input();
int p= (ledport );
ledport.output();
pcscreen.printf("read: %X%c%c",p,'\n','\r');
fprintf(fp, "%d\n\r",p);
}
int main() {
setup();
while (1) {
loop ();
}
}
I have gotten into a situation where I seem unable to mount the mbed onto the mac's filesystem. I THINK what is going on is that it disconnects from the file system as soon as it starts to run the above program. If I hold down the reset button while I plug it into the USB port, I do see it appear briefly in the finder, with an error box that says it was ejected improperly last time, then it unmounts itself as the program on the mbed starts to run, I think. Help!
while trying to learn how things work I wrote this little program. I'm on a mac
<<code>>
#include "mbed.h"
// LED1 = P1.18 LED2 = P1.20 LED3 = P1.21 LED4 = P1.23
#define LED_MASK 0x00140000
PortInOut ledport(Port1, LED_MASK);
Serial pcscreen( USBTX,USBRX); // when you start, in terminal type:
// screen /dev/tty.usbmodemfa132
PwmOut myled(LED1);
float brightness =0.5;
LocalFileSystem local("local"); // Create the local filesystem under the name "local"
FILE *fp;
void setup() {
pcscreen.printf("b to make it brighter, d to make it dimmer\n");
ledport=LED_MASK;
fp = fopen("/local/out.txt", "w"); // Open "out.txt" on the local file system for writing
}
void loop ( ) {
myled = brightness;
char c;
c = pcscreen.getc();
if (c == 'b') brightness += 0.02;
if (c == 'd') brightness -= 0.02;
if (c == 'n') ledport.write(LED_MASK);
if (c == 'f') ledport = 0;
if (c == 'q') fclose(fp);
ledport.input();
int p= (ledport );
ledport.output();
pcscreen.printf("read: %X%c%c",p,'\n','\r');
fprintf(fp, "%d\n\r",p);
}
int main() {
setup();
while (1) {
loop ();
}
}
<</code>>
I have gotten into a situation where I seem unable to mount the mbed onto the mac's filesystem. I THINK what is going on is that it disconnects from the file system as soon as it starts to run the above program. If I hold down the reset button while I plug it into the USB port, I do see it appear briefly in the finder, with an error box that says it was ejected improperly last time, then it unmounts itself as the program on the mbed starts to run, I think. Help!
ah, I was just not reading the info in the handbook carefully. by keeping the reset button down until it downloaded another program it did mount and the problem is resolved.
ah, I was just not reading the info in the handbook carefully. by keeping the reset button down until it downloaded another program it did mount and the problem is resolved.
Important Information for this Arm website
This site uses cookies to store information on your computer.
By continuing to use our site, you consent to our cookies.
If you are not happy with the use of these cookies, please review our
Cookie Policy
to learn how they can be disabled.
By disabling cookies, some features of the site will not work.
Access Warning
You do not have the correct permissions to perform this operation.
while trying to learn how things work I wrote this little program. I'm on a mac
I have gotten into a situation where I seem unable to mount the mbed onto the mac's filesystem. I THINK what is going on is that it disconnects from the file system as soon as it starts to run the above program. If I hold down the reset button while I plug it into the USB port, I do see it appear briefly in the finder, with an error box that says it was ejected improperly last time, then it unmounts itself as the program on the mbed starts to run, I think. Help!