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: m3pi mbed-rtos mbed
m3pi_pov.cpp
00001 #include "m3pi_pov.h" 00002 #include "alphabet.h" 00003 00004 #define SPIN_SPEED 1.0 00005 #define PIXEL_TIME 0.002 00006 00007 BusOut _leds; 00008 m3pi m3pi; 00009 00010 int pov_display = 1; // flag for pov display while loop 00011 00012 pov::pov(PinName l1, PinName l2, PinName l3, PinName l4, PinName l5, 00013 PinName l6, PinName l7, PinName l8) { 00014 _leds(l8, l7, l6, l5, l4, l3, l2, l1); 00015 } 00016 00017 pov:::pov() { 00018 _leds(p20, p19, p18, p17, p16, p15, p14, p13); 00019 } 00020 00021 00022 void pov::init(void) { 00023 m3pi.right(SPIN_SPEED); 00024 } 00025 00026 void pov::init(int spin) { 00027 if (spin < 0) { 00028 m3pi.left(); 00029 } else { 00030 m3pi.right(); 00031 } 00032 } 00033 00034 void pov::stop(void) { 00035 pov_display = 0; 00036 m3pi.stop(); 00037 } 00038 00039 void pov::display(char* text) { 00040 pov_display = 1; 00041 while (pov_display) { 00042 for (char* it = text; *it; ++it) { 00043 char[] arr = _get_char_arr(it); 00044 for (int i = 0; i < 6; i++) { 00045 char a = arr[i]; 00046 _leds = (int) a; 00047 wait(PIXEL_TIME); 00048 } 00049 } 00050 } 00051 } 00052 00053 char[] pov::_get_char_arr(char c) { 00054 int arr_loc = c - 32; 00055 return font[arr_loc]; 00056 } 00057 00058 00059 00060 00061
Generated on Thu Jul 14 2022 09:10:10 by
