A program to measure the temperature using the Max6675 board. The temperature is shown on 8x8 Max7219 matrix display and it is saved on SD as well.
Dependencies: MAX7219 SDFileSystem mbed
Fork of MAXREFDES99_demo by
The program measures the temperature using the Max6675 board designed for Arduino. The temperature is shown on Max7219 8x8 matrix display (designed for Arduino as well) as text marque from right to left. The fonf size is 5x7 so the last row is used to show some info:
- All leds off: Normal temperature measuring - Leds shifting: Saving on SD card - Leds blinking: SD card missing or damaged
The Blue "user button" is used to save measured temperature on SD card. First click start saving, the second stop the process. Together the temperature is saved also the time. The time is reset when the process start. Connecting the USB to PC it's possible to see instant temperature and all saved data on SD.
Diff: main.cpp
- Revision:
- 3:41bdbc9b3cec
- Parent:
- 0:6b0161c3e440
- Child:
- 6:00aabe967e51
--- a/main.cpp Thu Mar 24 23:35:56 2016 +0000 +++ b/main.cpp Mon Apr 11 16:19:13 2016 +0000 @@ -30,10 +30,8 @@ * ownership rights. **********************************************************************/ - #include "maxrefdes99.h" - int main(void) { Max7219 display(D11, D12, D13, D10); @@ -57,7 +55,7 @@ display.enable_display(); - uint32_t user_input = 0; // + uint32_t user_input = 0,user_font = 0; uint32_t shift_right; char user_char; char *p_str; @@ -68,7 +66,13 @@ switch(user_input) { - case 1: + + case 1: + + user_font = get_user_input("\nPlease enter 0 to use 5x7 font or 1 to use 16x16 font: ", 1); + break; + + case 2: user_input = get_user_input("\nPlease enter a value from 0 to 15: ", 15); @@ -83,82 +87,98 @@ break; - case 2: - - user_input = get_user_input("\nPlease enter which position, 1 to 32: ", 32); + case 3: + + if(user_font==0) + user_input = get_user_input("\nPlease enter which position, 1 to 32: ", 32); + + user_char = get_user_char("\nPlease enter an ASCII character from '0' (zero) to 'z' (0x7A): "); - user_char = get_user_char("\nPlease enter an ASCII character from 'space' (0x20), to '~' (0x7E): "); - - print_char(&display, user_input, user_char); - + if(user_font==0) + print_char(&display, user_input, user_char); + else if(user_font==1) + print_char_16x16(&display, 0, user_char); + //make sure is good for next loop user_input = 0; break; - case 3: + case 4: + if(user_font==0) user_input = get_user_input("\nPlease enter which position, 1 to 32: ", 32); - + p_str = get_user_string("\nPlease enter a string less than 24 characters: "); - print_string(&display, user_input, p_str); - + if(user_font==0) + print_string(&display, user_input, p_str); + else if(user_font==1) + print_string_16x16(&display,p_str); + //make sure is good for next loop user_input = 0; break; - case 4: + case 5: - user_input = get_user_input("\nPlease enter number of shifts, 1 to 32: ", 32); - shift_right = get_user_input("\nWhich direction? 0 for left, 1 for right.: ", 1); + if(user_font==0) + user_input = get_user_input("\nPlease enter number of shifts, 1 to 32: ", 32); + else if(user_font==1) + user_input = get_user_input("\nPlease enter number of shifts, 1 to 96: ", 96); + + shift_right = get_user_input("\nWhich direction? 0 for left, 1 for right: ", 1); if(shift_right) { printf("\nShifting Display Right %d positions\n", user_input); - shift_display_right(&display, user_input, 100); + if(user_font==0) + shift_display_right(&display, user_input, 100); + else if(user_font==1) + shift_display_right_16x16(&display, user_input, 100); } else { printf("\nShifting Display Left %d positions\n", user_input); - shift_display_left(&display, user_input, 100); + if(user_font==0) + shift_display_left(&display, user_input, 100); + else if(user_font==1) + shift_display_left_16x16(&display, user_input, 100); + } break; - case 5: + case 6: all_off(&display); break; - case 6: + case 7: printf("\nRunning Demo\n"); + if(user_font==0) demo(&display, display_config, false); + else if(user_font==1) + demo_16x16(&display, display_config, false); break; - - case 7: - - printf("\nEntering Endless Loop\n"); - demo(&display, display_config, true); - - break; - + case 8: //blocking case, endless loop - shift_right = get_user_input("\nWhich direction? 0 for left, 1 for right.: ", 1); + shift_right = get_user_input("\nWhich direction? 0 for left, 1 for right: ", 1); + if(user_font==0) endless_scroll_display(&display, shift_right); + else if(user_font==1) + endless_scroll_display_16x16(&display, shift_right); break; case 9: - - printf("\nEnding Program\n"); - + printf("\nEnding Program\n"); break; default: @@ -169,3 +189,4 @@ return 0; } +