Add serial module
This commit is contained in:
parent
dc55372220
commit
6eef193bcd
3 changed files with 59 additions and 22 deletions
1
src/modules/info_001_serial_number/3d/.gitignore
vendored
Normal file
1
src/modules/info_001_serial_number/3d/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
*.stl
|
49
src/modules/info_001_serial_number/3d/case.scad
Normal file
49
src/modules/info_001_serial_number/3d/case.scad
Normal file
|
@ -0,0 +1,49 @@
|
|||
$fn=500;
|
||||
screen_width=72;
|
||||
screen_height=26;
|
||||
case_wall=0.9;
|
||||
inner_size=95;
|
||||
outer_size=inner_size+2*case_wall;
|
||||
cut=100;
|
||||
layer=0.3;
|
||||
height=50;
|
||||
m3_hole = 3.4;
|
||||
|
||||
module top() {
|
||||
difference() {
|
||||
cylinder(d=inner_size, h=case_wall);
|
||||
cube(size=[screen_width, screen_height, cut], center=true);
|
||||
translate([0, inner_size/2, 0]) cylinder(r=5, h=cut);
|
||||
translate([0, -inner_size/2, 0]) cylinder(r=5, h=cut);
|
||||
}
|
||||
translate([0, screen_height, case_wall])
|
||||
linear_extrude(height=case_wall+2*layer, center=true, convexity=10, twist=0) {
|
||||
text("Serial", halign="center", font="Liberation Mono:style=Bold");
|
||||
}
|
||||
}
|
||||
|
||||
module bottom() {
|
||||
difference() {
|
||||
cylinder(d=outer_size, h=height);
|
||||
union() {
|
||||
translate([0, 0, case_wall]) cylinder(d=inner_size-4, h=cut);
|
||||
translate([0, 0, 50-case_wall]) cylinder(d=inner_size+0.5, h=cut);
|
||||
translate([0, 0, 10]) rotate([0, 90, 0]) cylinder(d=12, h=cut);
|
||||
translate([20, 20, -1]) cylinder(d=m3_hole, h=cut);
|
||||
translate([20, -20, -1]) cylinder(d=m3_hole, h=cut);
|
||||
translate([-20, 20, -1]) cylinder(d=m3_hole, h=cut);
|
||||
translate([-20, -20, -1]) cylinder(d=m3_hole, h=cut);
|
||||
}
|
||||
}
|
||||
intersection() {
|
||||
cylinder(d=outer_size, h=height);
|
||||
union() {
|
||||
translate([0, inner_size/2, 0]) cylinder(r=5-0.25, h=height);
|
||||
translate([0, -inner_size/2, 0]) cylinder(r=5-0.25, h=height);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
%translate([0, 0, height-case_wall]) top();
|
||||
bottom();
|
|
@ -14,38 +14,25 @@ The serial number consists of capital letters and numbers, and is guaranteed to
|
|||
at least one capital letter and one number.
|
||||
*/
|
||||
|
||||
|
||||
#include <Wire.h>
|
||||
#include <obus_module.h>
|
||||
#include <LiquidCrystal.h>
|
||||
|
||||
// Pins for the Hitachi HD44780 LCD controller
|
||||
#define PIN_LCD_RS 7 // Register Select. RS=0: Command, RS=1: Data
|
||||
#define PIN_LCD_ENABLE 6 // Enable (aka Clock). A falling edge on this pin triggers execution
|
||||
#define PIN_LCD_D0 5
|
||||
#define PIN_LCD_D1 4
|
||||
#define PIN_LCD_D2 3
|
||||
#define PIN_LCD_D3 2
|
||||
#include <LiquidCrystal_I2C.h>
|
||||
|
||||
#define SERIAL_NUMBER_SIZE 7
|
||||
LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C address 0x27, 16 column and 2 rows
|
||||
|
||||
uint8_t serial_number[SERIAL_NUMBER_SIZE];
|
||||
uint8_t serial_number[SERIAL_NUMBER_SIZE] = {'A', '0', '0', '0', '0', '0',' 0'};
|
||||
|
||||
// true when we need to update the LCD display
|
||||
bool render_now = false;
|
||||
LiquidCrystal lcd(
|
||||
PIN_LCD_RS,
|
||||
PIN_LCD_ENABLE,
|
||||
PIN_LCD_D0,
|
||||
PIN_LCD_D1,
|
||||
PIN_LCD_D2,
|
||||
PIN_LCD_D3
|
||||
);
|
||||
bool render_now = true;
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
lcd.begin(16, 2);
|
||||
lcd.clear();
|
||||
lcd.init(); // initialize the lcd
|
||||
lcd.backlight();
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print("init");
|
||||
obus_module::setup(OBUS_TYPE_INFO, 1);
|
||||
}
|
||||
|
Loading…
Reference in a new issue