diff --git a/src/modules/info_001_serial_number/3d/.gitignore b/src/modules/info_001_serial_number/3d/.gitignore new file mode 100644 index 0000000..1567411 --- /dev/null +++ b/src/modules/info_001_serial_number/3d/.gitignore @@ -0,0 +1 @@ +*.stl diff --git a/src/modules/info_001_serial_number/3d/case.scad b/src/modules/info_001_serial_number/3d/case.scad new file mode 100644 index 0000000..45fe966 --- /dev/null +++ b/src/modules/info_001_serial_number/3d/case.scad @@ -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(); \ No newline at end of file diff --git a/src/modules/info_001_serial_number/info_serial_number.ino b/src/modules/info_001_serial_number/info_001_serial_number.ino similarity index 74% rename from src/modules/info_001_serial_number/info_serial_number.ino rename to src/modules/info_001_serial_number/info_001_serial_number.ino index 6d402b6..563c769 100644 --- a/src/modules/info_001_serial_number/info_serial_number.ino +++ b/src/modules/info_001_serial_number/info_001_serial_number.ino @@ -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 #include -#include - -// 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 #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); }