![]() ![]() This allows the sound to be played on speakers or headphones or recorded with a program, such as Audacity. The sound that the microphone is "recording" is the data on the SD card that it sends to the host computer. The Mbed board acts as the computer's USB microphone. You can then play the WAV file from the board on a host computer over USB. You will load a WAV file onto an SD card connected to an Mbed board. This tutorial explains how to put together a USB WAV audio player with Mbed OS. Lcd.printf("Temp Alarm Setting = %.USB WAV audio player USB WAV audio player Lcd.printf("Board Temperature = %.2f\n\r",board_temp) Īlarm_temp = 50.0 * pot1 //read alarm temp R=1.0 //RGB LED off - PWM 100% duty cycle generate a 800Hz tone using PWM hardware output Serial pc(USBTX,USBRX) //used for printf to PC over USB PwmOut speaker(p26) //Speaker with PWM driverĪnalogIn pot1(p19) //Reads Pot 1 - near LCDĪnalogIn pot2(p20) //Reads Pot 2 - near RGB LED PwmOut r(p23) //RGB LED with 3 PWM outputs for dimmer control LM75B tmp(p28,p27) //I2C Temperature Sensor The pot voltage is read in and scaled between 0.0 and 1.0 by the mbed AnalogIn API. The RGB LED and speaker are attached using hardware PWM outputs and setup using the mbed PwmOut API. When the board temperature is below the alarm setting, the RGB LED is green and when it is above the RGB LED changes to RED and the speaker outputs a tone. Pot 1 (blue dial near LCD) is used to adjust a temperature alarm setting (also shown on LCD). The temperature is displayed on the LCD using text mode with printfs. After a few minutes of operation, the board is typically around 5C above room temperature. The third demo uses the board’s I2C temperature sensor to measure the board’s temperature. Tilting the board moves the solid black bubble. Save it on the mbed flash drive and hit reset.Ī bubble level display using accelerometer data. This demo uses the application board’s three axis accelerometer and the LCD display working in graphics mode to build an electronic version of a bubble level.Īpp-board-bubble-level_lpc1768.bin - has the compiled code. The LCD graphics library has a handy member function to draw circles and the library code for the accelerometer returns G force readings, so the code is relatively short. As the board is tilted, the X and Y G forces are used move the small black bubble on the display. The project can then be compiled and downloaded to the mbed module. ![]() Clicking on the “import program” link below copies all of the project files into the cloud compiler and sets up a new project. The second demo uses the board’s three axis accelerometer and the LCD display working in graphics mode to build an electronic version of a bubble level. There should be an extra row of black socket pins on both sides of the mbed module. There are also small “GND” and “VOUT” silkscreen labels on the board and mbed module that should line up (near USB cable on left in image below). Note the correct orientation in the photo below. Save it on the mbed flash drive, hit the mbed reset button and the LED should blink.įor the second demo, the mbed must first be carefully plugged into the mbed application board. In the code, note the use of the mbed DigitalOut() and wait() APIs.Īpp-board-blink_led_lpc1768.bin - has the compiled code. Click on “main.cpp” to view the C code in the compiler window. Hit the reset button on the mbed module, to run the most recently downloaded code. Click “compile” and save the compiled bin file to the mbed flash drive. You must always logon first to use the compiler. The project files are all stored on a cloud server. Select a name for your new program and click "OK". Logon, click on the compiler link (upper right) and select new when the compiler appears. The mbed module appears as a USB flash drive, open the flash drive, and click on the file“mbed.htm” and follow the instructions to signup for a new account. A new user account must be setup to use the cloud compiler and the mbed module must be plugged in first to setup a new account. It is the default project code for a new project in the online cloud compiler. This first demo just blinks an LED on the mbed module and the application board is not required. PowerPoint slides used prior to this material at the workshop to introduce mbed to faculty are also available. While working through the demos, keep this web page open in one browser tab while the compiler is open in another browser tab so that it is possible to quickly switch back and forth between the two web pages. Libraries used have also been updated to the most recent versions as of 9/22/13. They are based on selected code examples and I/O libraries posted earlier in the cookbook’s mbed application board page. These examples for the application board were developed for the ARM University Program Faculty Workshop at ESWEEK 2013. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |