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.
Dependencies: C12832 MMA7660 mbed
Fork of app-shield-accelerometer by
Revision 2:a87e255a8f3a, committed 2012-10-26
- Comitter:
- chris
- Date:
- Fri Oct 26 10:49:28 2012 +0000
- Parent:
- 1:1c6a9eaf55b5
- Child:
- 3:2db94ee076ee
- Commit message:
- First check in
Changed in this revision
--- a/C12832_lcd.lib Tue Oct 16 17:51:10 2012 +0000 +++ b/C12832_lcd.lib Fri Oct 26 10:49:28 2012 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/dreschpe/code/C12832_lcd/#66dd8afbfd06 +http://mbed.org/users/dreschpe/code/C12832_lcd/#468cdccff7af
--- a/LCD_fonts.lib Tue Oct 16 17:51:10 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/dreschpe/code/LCD_fonts/#ac9b0945fdb1
--- a/main.cpp Tue Oct 16 17:51:10 2012 +0000
+++ b/main.cpp Fri Oct 26 10:49:28 2012 +0000
@@ -1,124 +1,19 @@
-// example to test the mbed Lab Board lcd
-// Pot1 change the contrast
-// Pot2 change the speed of the sin wave
-
-
#include "mbed.h"
-#include "rtos.h"
-#include "Small_6.h"
-#include "Small_7.h"
-#include "Arial_9.h"
-#include "stdio.h"
#include "C12832_lcd.h"
-Serial pc(USBTX, USBRX);
-
-
-// LCD object
-C12832_LCD LCD("LCD");
-
-AnalogIn Pot1(p19);
-AnalogIn Pot2(p20);
-
-// defines to make lib thread save
-#define _lock lcd_mutex.lock();
-#define _unlock lcd_mutex.unlock();
-Mutex lcd_mutex;
-
-// print data into first line and wait for 1s
-void thread1(void const *args)
-{
- int i;
- while(true) { // thread loop
- _lock
- LCD.locate(0,0);
- LCD.set_font((unsigned char*) Small_6);
- printf("Thread1 count: %d",i);
- LCD.copy_to_lcd();
- _unlock
- i++;
- Thread::wait(1000);
- }
-}
-
-// print data into third line and wait for 0,5s
-void thread2(void const *args)
-{
- int k;
- while(true) { // thread loop
- _lock
- LCD.locate(0,20);
- LCD.set_font((unsigned char*) Arial_9);
- printf("Thread 2 count : %d",k);
- LCD.copy_to_lcd();
- _unlock
- k++;
- Thread::wait(500);
- }
-}
-
-
-void thread4(void const *args)
-{
- int i,k,v;
- double s,a;
- k = 1;
- _lock
- LCD.rect(89,0,127,17,1);
- _unlock
- while(true) { // thread loop
- _lock
- v = Pot1.read_u16(); // get value of pot 1
- for (i=90; i<127; i++) {
- s = 8 * sin((long double)(i+k) /5);
- a = 8 * sin((long double)(i+k-1) /5);
- LCD.pixel(i,9 + (int)a ,0);
- LCD.pixel(i,9 + (int)s ,1);
- }
- LCD.copy_to_lcd();
- _unlock
- k++;
- Thread::wait(v/100);
- }
-}
-
-
-void thread5(void const *args)
-{
- int k;
- while(true) { // thread loop
- k = Pot2.read_u16(); // get the value of poti 2
- k = k >> 10; // we need only 6 bit
- _lock
- LCD.set_contrast(k);
- _unlock
- Thread::wait(500);
-}
-}
+C12832_LCD lcd;
int main()
{
- int j;
-
- LCD.claim(stdout); // send stdout to the LCD display
- LCD.cls();
- //start thread1
- Thread t1(thread1);
- //start thread2
- Thread t2(thread2);
- //start thread4
- Thread t4(thread4);
- Thread t5(thread5);
+ int j=0;
+ lcd.cls();
+ lcd.locate(0,3);
+ lcd.printf("mbed application board!");
while(true) { // this is the third thread
- _lock
- LCD.locate(0,9);
- LCD.set_font((unsigned char*) Small_7);
- j = LCD.get_contrast();
- printf("contrast : %d",j);
- LCD.copy_to_lcd();
- _unlock
- Thread::wait(500);
+ lcd.locate(0,15);
+ lcd.printf("Counting : %d",j);
+ j++;
+ wait(1.0);
}
-
}
--- a/mbed-rtos.lib Tue Oct 16 17:51:10 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed-rtos/#9654a71f5a90
