The Aliens Legacy http://www.forum.alienslegacy.com/ |
|
security access tuner from alien isolation http://www.forum.alienslegacy.com/viewtopic.php?f=3&t=19914 |
Page 1 of 3 |
Author: | knoxvilles_joker [ Sun Jan 08, 2023 7:50 pm ] |
Post subject: | security access tuner from alien isolation |
As I am progresing slowly on building the arduino game on this I am creating a dedicated thread on the build. The 3d file for the access tuner https://www.thingiverse.com/thing:5217302 The screen willl be a 2.6" https://www.digole.com/?p=1271 I am still working on the access tuner coding piece. I will have to stick with the arduino due to utter lack of space. https://www.youtube.com/watch?v=d895TgMifNo And here are some good stills I can use for reference https://ilikeinterfaces.com/2015/04/02/ ... isolation/ Due to space issues an arduino or nano or pico are the only real options. The arduino is a better option as it can be a more voltage and power tolerant unit, the pies require a steady power supply. |
Author: | knoxvilles_joker [ Sun Jan 08, 2023 8:58 pm ] |
Post subject: | |
Ok for the charging and power I am looking at using a lipo: https://www.adafruit.com/product/2465 This charging board is a good option. I will add in a female barrel connector for a charging port. I will then have a barrel connector to usb connector cable to use for charging. After dealing with my pke meter I will use screw terminals for all wiring connectors in case things break or get pulled out. |
Author: | knoxvilles_joker [ Sun Jan 08, 2023 10:03 pm ] |
Post subject: | |
Of these two pots one should work for the left slider pot. I am concluding for more accurate functionality in the arduino game I need 2 pots and the bottom knob is not a good design location on the bottom. OK, I found a slide potentiometer. https://www.digikey.com/en/products/det ... ncQAvD_BwE https://www.digikey.com/en/products/det ... ZgQAvD_BwE And this is what I believe is a potentiometer that would work with the housing itself. https://www.digikey.com/en/products/det ... 0K/4780740 These are the buttons I used (fyi these are darned freaking close to the size of the buttons on the 3d print and found in the game used unit... https://www.amazon.com/gp/product/B0752 ... UTF8&psc=1 And here is a good on/off rocker switch: https://www.amazon.com/gp/product/B07Y1 ... YMCKV&th=1 |
Author: | knoxvilles_joker [ Sun Jan 08, 2023 11:19 pm ] |
Post subject: | Re: security access tuner from alien isolation |
In process code. It works. Code: /*Libraries provided by adafruit written by Lady Ada Fried.
*Please stick to adafruit products as chinese knock offs are very, *very, very, problematic. * code for bar courtesy of: * https://forum.arduino.cc/t/tft-progress-bar-wont-go-back-down/989189 * some code pulled from isolation motion tracker pulled from: * https://www.instructables.com/Arduino-Motion-Tracker-From-Alien-Isolation/?fbclid=IwAR2P0H8tUwBisNGaP4C2vccz-fbBOlxxfdm8EIJJEHgAZnKOtgemeBjAZ3M * * * */ #include <SPI.h> #include "Adafruit_GFX.h" #include "Adafruit_ILI9341.h" // For the Adafruit shield, these are the default. #define TFT_DC 9 #define TFT_CS 10 #define TFT_MOSI 11 #define TFT_CLK 13 #define TFT_RST 12 #define TFT_MISO 8 #define TFT_CS 10 // Assign human-readable names to some common 16-bit color values: #define BLACK 0x0000 #define BLUE 0x001F #define RED 0xF800 #define GREEN 0x07E0 #define CYAN 0x07FF #define MAGENTA 0xF81F #define YELLOW 0xFFE0 #define WHITE 0xFFFF //TFT TFTscreen = TFT(cs, dc, rst); Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO); void setup() { pinMode(A0, INPUT); tft.begin(); tft.fillScreen(BLACK); tft.setRotation(3); txt(); tft.setRotation(0); tft.fillScreen(BLACK); tft.setRotation(1); } void loop() { int bar = map(analogRead(A0), 0, 1023, 0, 308); tft.fillRect(6, 80, bar, 44, RED); tft.fillRect(bar+1, 80, 308 - bar, 44, BLACK); } void txt() {//Starting :) tft.fillScreen(BLACK); tft.setCursor(60, 20); tft.setTextColor(WHITE); tft.setTextSize(5); tft.println("B2-LAB"); tft.setCursor(20, 80); tft.setTextColor(GREEN); tft.setTextSize(3); tft.println("MOTION-TRACKER"); tft.setCursor(10,130); tft.setTextColor(RED); tft.setTextSize(2); tft.println("^VERTICAL WHEN OPERATING^"); tft.setCursor(60, 150); tft.setTextColor(GREEN); tft.setTextSize(2); tft.print("Calibrate Sensors"); tft.setCursor(10, 170); tft.setTextSize(3); for(int i=0;i<8;i++) { tft.print("."); delay(1000); } } void boot1() { } void boot2() { } void game1() {} void game2() {} |
Author: | knoxvilles_joker [ Mon Jan 09, 2023 3:29 am ] |
Post subject: | |
I am working out the logic on paper at this point. I am trying to get what I can. As far as I can figure I need to run separate functions for the screens. The initialization portion I can do in the setup section, but the other screens I would need to call in the main void loop. I have very limited horsepower to work with so I have to be careful on how I do things. |
Author: | Space Jockey [ Mon Jan 09, 2023 6:42 pm ] |
Post subject: | |
I believe the tuner for the game was based on a real-world Pilot Rescue Survival Radio, Prc90-2. |
Author: | knoxvilles_joker [ Tue Jan 10, 2023 3:46 am ] |
Post subject: | Re: |
Space Jockey wrote: I believe the tuner for the game was based on a real-world Pilot Rescue Survival Radio, Prc90-2. well, give me a bit and we will have another game hardware build... |
Author: | septic [ Tue Jan 10, 2023 4:34 am ] |
Post subject: | Re: |
Space Jockey wrote: I believe the tuner for the game was based on a real-world Pilot Rescue Survival Radio, Prc90-2. Heh, I was just about to post the same [didn't notice your post, first read-through] ![]() I collect Vietnam War era bits and bobs, & have a copy of these little radios. Ref pics HERE |
Author: | Space Jockey [ Tue Jan 10, 2023 2:25 pm ] |
Post subject: | Re: Re: |
septic wrote: Ref pics HERE Very nice reference pics ![]() I love stuff like this with all the dials and nuts & bolts. I'd love to make a security tuner at some point but will have to wait until I move and have more room. I still have pulse rifle parts sitting around I need to put together. I wouldn't want to convert a real radio. if you own one, would you be willing to please provide a couple of dimensions so I can get some cad files drawn up for us all? I also like the Nostromo beacon case that Amanda finds in Sevastopol. |
Author: | knoxvilles_joker [ Tue Jan 10, 2023 5:21 pm ] |
Post subject: | Re: Re: |
Space Jockey wrote: septic wrote: Ref pics HERE Very nice reference pics ![]() I love stuff like this with all the dials and nuts & bolts. I'd love to make a security tuner at some point but will have to wait until I move and have more room. I still have pulse rifle parts sitting around I need to put together. I wouldn't want to convert a real radio. if you own one, would you be willing to please provide a couple of dimensions so I can get some cad files drawn up for us all? I also like the Nostromo beacon case that Amanda finds in Sevastopol. If someone makes 3d files on that nostromo case, let me know. I just have to hash out the coding on the display, maybe add the final report from the end of alien. |
Author: | knoxvilles_joker [ Sat Jan 14, 2023 1:43 am ] |
Post subject: | Re: |
Space Jockey wrote: I believe the tuner for the game was based on a real-world Pilot Rescue Survival Radio, Prc90-2. https://www.prc68.com/I/PRC90.shtml I see the similarities. But it stops there. |
Author: | septic [ Sat Jan 14, 2023 5:14 am ] |
Post subject: | Re: Re: |
knoxvilles_joker wrote: Same as my link above fulla ![]() Space Jockey wrote: [ I wouldn't want to convert a real radio. if you own one, would you be willing to please provide a couple of dimensions so I can get some cad files drawn up for us all? Yup, will do in the next day or two. |
Author: | knoxvilles_joker [ Sat Jan 14, 2023 5:36 am ] |
Post subject: | Re: Re: |
septic wrote: knoxvilles_joker wrote: Same as my link above fulla ![]() Space Jockey wrote: [ I wouldn't want to convert a real radio. if you own one, would you be willing to please provide a couple of dimensions so I can get some cad files drawn up for us all? Yup, will do in the next day or two. I would add once we get a more accuratized cad drawing, it would greatly help if we have it built to accept the bits so we can more easily drop in electronics. I have no issues sending parts or such, but I think most of the stuff I link gives good dimentions other than a couple of parts. The kicker is I have issues finding exactly accurate parts, but close enough only a fine eye could tell... I would only add that a 2.8" screen is the good screen size, but won't fit... |
Author: | knoxvilles_joker [ Sat Jan 14, 2023 9:54 am ] |
Post subject: | Re: security access tuner from alien isolation |
OK I got the slider bar to move all the way around the corner. Took me a while to wrap my mind around remap logic and limited manipulation functions of the arduino Code: /*Libraries provided by adafruit written by Lady Ada Fried.
*Please stick to adafruit products as chinese knock offs are very, *very, very, problematic. * code for bar courtesy of: * https://forum.arduino.cc/t/tft-progress-bar-wont-go-back-down/989189 * some code pulled from isolation motion tracker pulled from: * https://www.instructables.com/Arduino-Motion-Tracker-From-Alien-Isolation/?fbclid=IwAR2P0H8tUwBisNGaP4C2vccz-fbBOlxxfdm8EIJJEHgAZnKOtgemeBjAZ3M * * * */ #include <SPI.h> #include "Adafruit_GFX.h" #include "Adafruit_ILI9341.h" // For the Adafruit shield, these are the default. #define TFT_DC 9 #define TFT_CS 10 #define TFT_MOSI 11 #define TFT_CLK 13 #define TFT_RST 12 #define TFT_MISO 8 #define TFT_CS 10 // Assign human-readable names to some common 16-bit color values: #define BLACK 0x0000 #define BLUE 0x001F #define RED 0xF800 #define GREEN 0x07E0 #define CYAN 0x07FF #define MAGENTA 0xF81F #define YELLOW 0xFFE0 #define WHITE 0xFFFF //TFT TFTscreen = TFT(cs, dc, rst); Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO); void setup() { pinMode(A0, INPUT); tft.begin(); tft.fillScreen(BLACK); tft.setRotation(1); //this sets 0,0 as the top left corner txt(); // tft.setRotation(0); tft.fillScreen(BLACK); tft.setRotation(1); } void loop() { int myHeight = tft.height(); int myWidth = tft.width(); int bar = map(analogRead(A0), 0, 1023, 0, 308); tft.fillRect(6, 80, bar, 44, RED); tft.fillRect(bar, 80, 308 - bar, 44, BLACK); tft.fillRect(0, 20, myWidth, 5, BLACK); // draws pot number reading tft.setCursor(80,40); tft.setTextColor(RED); tft.setTextSize(3); tft.println(analogRead(A0)); // add rendering pause delay(100); // clears drawings tft.fillRect(bar, 20, 20, 5, WHITE); tft.fillRect(80, 40, 80, 30, BLACK); game1(); // tft.fillScreen(BLACK); } void txt() {//Starting :) tft.fillScreen(BLACK); tft.setCursor(60, 20); tft.setTextColor(WHITE); tft.setTextSize(5); tft.println("B2-LAB"); tft.setCursor(20, 80); tft.setTextColor(GREEN); tft.setTextSize(3); tft.println("MOTION-TRACKER"); tft.setCursor(10,130); tft.setTextColor(RED); tft.setTextSize(2); tft.println("^VERTICAL WHEN OPERATING^"); tft.setCursor(60, 150); tft.setTextColor(GREEN); tft.setTextSize(2); tft.print("Calibrate Sensors"); tft.setCursor(10, 170); tft.setTextSize(3); for(int i=0;i<4;i++) { tft.print("."); delay(1000); } } void boot1() { } void boot2() { } void game1() { int myHeight = tft.height(); int myWidth = tft.width(); //I ended up having to separate out remaps for each side of the slider bar int bordw = map(analogRead(A0), 0, 1023, 0, 1023); int bordt = map(analogRead(A0), 0, 256, 0, myWidth); int bordrh = map(analogRead(A0), 256, 512, 0, myHeight); int bordb = map(analogRead(A0), 512, 768, myWidth, 0); int bordlh = map(analogRead(A0), 768, 1023, myHeight, 0); //below greyed out was used to figure out logic of slider bar for game 1 /* // top border if (1 < bordw < 256){ tft.fillRect(bordt, 0, 20, 5, WHITE); delay(100); tft.fillRect(0, 0, myWidth, 5, BLACK); } // right border if (257 < bordw < 512){ tft.fillRect(myWidth -5, bordrh, 5, 20, WHITE); delay(100); tft.fillRect(myWidth -5, 0, 5, myHeight, BLACK); } // bottom border if (512 < bordw < 768){ tft.fillRect(bordb, (myHeight - 5), 20, 5, WHITE); delay(100); tft.fillRect(0, (myHeight - 5), myWidth, 5, BLACK); } if (768 < bordw < 1023){ tft.fillRect(0, bordlh, 5, 20, WHITE); delay(100); tft.fillRect(0, 0, 5, myHeight, BLACK); } */ //test // after figuring out logic I tested to see if just simplifying and condensing the statements without if cases would work tft.fillRect(bordt, 0, 20, 5, WHITE); tft.fillRect(myWidth -5, bordrh, 5, 20, WHITE); tft.fillRect(bordb, (myHeight - 5), 20, 5, WHITE); tft.fillRect(0, bordlh, 5, 20, WHITE); delay(100); tft.fillRect(0, 0, 5, myHeight, BLACK); tft.fillRect(0, 0, myWidth, 5, BLACK); tft.fillRect(myWidth -5, 0, 5, myHeight, BLACK); tft.fillRect(0, (myHeight - 5), myWidth, 5, BLACK); } void game2() {} |
Author: | knoxvilles_joker [ Sun Jan 15, 2023 7:04 am ] |
Post subject: | Re: security access tuner from alien isolation |
Knobs and buttons are installed ahead of resin coating. Attachment:
|
Author: | knoxvilles_joker [ Sun Jan 15, 2023 10:09 pm ] |
Post subject: | |
I am taking care to do geometry based calculations and division placement based on width/height. This will ensure if a different screen size is used, not a big issue. |
Author: | knoxvilles_joker [ Mon Jan 16, 2023 1:48 am ] |
Post subject: | Re: security access tuner from alien isolation |
OK progress so far: added first loading screen added second pot and readout for it fixed scrolling functionality of border bar (this one stretched my brain figuring out) added display of button presses (the current main run screen is used for calibration on settings to ensure I am getting where I need to) (this screen will later get added as an optional function to allow setup troubleshooting) next up will be to work on second load screen still waiting on some clarification on which font has the nice seegson logo teletype. the O is a distinctive type. I would rather not hand code the font manually as things would be rather painful and would tie things to a specific screen size. Care is being taken to make this screen size agnostic Code: /*Libraries provided by adafruit written by Lady Ada Fried. *Please stick to adafruit products as chinese knock offs are very, *very, very, problematic. * code for bar courtesy of: * https://forum.arduino.cc/t/tft-progress-bar-wont-go-back-down/989189 * some code pulled from isolation motion tracker pulled from: * https://www.instructables.com/Arduino-Motion-Tracker-From-Alien-Isolation/?fbclid=IwAR2P0H8tUwBisNGaP4C2vccz-fbBOlxxfdm8EIJJEHgAZnKOtgemeBjAZ3M * * * */ // Include the Bounce2 library found here : // https://github.com/thomasfredericks/Bounce2 #include <Bounce2.h> #include <SPI.h> #include "Adafruit_GFX.h" #include "Adafruit_ILI9341.h" #include <LcdProgressBar.h> #include <LiquidCrystal.h> // For the Adafruit shield, these are the default. #define TFT_DC 9 #define TFT_CS 10 #define TFT_MOSI 11 #define TFT_CLK 13 #define TFT_RST 12 #define TFT_MISO 8 #define TFT_CS 10 // Assign human-readable names to some common 16-bit color values: #define BLACK 0x0000 #define BLUE 0x001F #define RED 0xF800 #define GREEN 0x07E0 #define CYAN 0x07FF #define MAGENTA 0xF81F #define YELLOW 0xFFE0 #define WHITE 0xFFFF // button pins #define BUTTON_PIN_1 18 #define BUTTON_PIN_2 19 // pot pins are pins 14 and 15 Bounce debouncer1 = Bounce(); Bounce debouncer2 = Bounce(); //TFT TFTscreen = TFT(cs, dc, rst); Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO); void setup() { pinMode(A0, INPUT); tft.begin(); tft.fillScreen(BLACK); tft.setRotation(1); //this sets 0,0 as the top left corner txt(); boot1(); // tft.setRotation(0); tft.fillScreen(BLACK); tft.setRotation(1); // button initialization pinMode(BUTTON_PIN_1,INPUT_PULLUP); debouncer1.attach(BUTTON_PIN_1); debouncer1.interval(5); pinMode(BUTTON_PIN_2,INPUT_PULLUP); debouncer2.attach(BUTTON_PIN_2); debouncer2.interval(25); } void loop() { int myHeight = tft.height(); int myWidth = tft.width(); int bar = map(analogRead(A0), 0, 1023, 0, 308); tft.fillRect(6, 80, bar, 44, RED); tft.fillRect(bar, 80, 308 - bar, 44, BLACK); tft.fillRect(0, 20, myWidth, 5, BLACK); // draws pot number reading tft.setCursor(80,40); tft.setTextColor(RED); tft.setTextSize(3); tft.println(analogRead(A0)); // draws pot 2 number reading tft.setCursor(160,40); tft.setTextColor(RED); tft.setTextSize(3); tft.println(analogRead(A1)); // clears button status tft.fillRect(80, 140, 100, 30, BLACK); // add rendering pause delay(100); // clears drawings tft.fillRect(bar, 20, 20, 5, WHITE); tft.fillRect(80, 40, 200, 30, BLACK); game1(); // declarations for buttons debouncer1.update(); debouncer2.update(); int value1 = debouncer1.read(); int value2 = debouncer2.read(); // draws button 2 status tft.setCursor(160,140); tft.setTextColor(RED); tft.setTextSize(3); tft.println(value2); // draws button 1 status tft.setCursor(80,140); tft.setTextColor(RED); tft.setTextSize(3); tft.println(value1); } void txt() {//Starting :) tft.fillScreen(BLACK); tft.setCursor(60, 20); tft.setTextColor(WHITE); tft.setTextSize(5); tft.println("B2-LAB"); tft.setCursor(20, 80); tft.setTextColor(GREEN); tft.setTextSize(3); tft.println("MOTION-TRACKER"); tft.setCursor(10,130); tft.setTextColor(RED); tft.setTextSize(2); tft.println("^VERTICAL WHEN OPERATING^"); tft.setCursor(60, 150); tft.setTextColor(GREEN); tft.setTextSize(2); tft.print("Calibrate Sensors"); tft.setCursor(10, 170); tft.setTextSize(3); for(int i=0;i<4;i++) { tft.print("."); delay(1000); } } void boot1() { int myHeight = tft.height(); int myWidth = tft.width(); byte progress = myWidth/8; tft.fillScreen(BLACK); tft.setCursor(20, 10); tft.setTextColor(GREEN); tft.setTextSize(6); tft.println("SEEGSON"); tft.drawRect(myWidth/8, myHeight*3/5, myWidth/2, 50, GREEN); for(int i=0;i<40;i++) { tft.fillRect(myWidth/8, myHeight*3/5, progress, 50, GREEN); tft.setTextSize(2); tft.setCursor(10, 100); tft.print("Progress = "); tft.setTextSize(2); tft.setCursor(140, 100); tft.println(progress); delay(20); tft.fillRect(140, 100, 50, 20, BLACK); progress += 5; delay(300); } } void boot2() { } void game2() {} void game1() { int myHeight = tft.height(); int myWidth = tft.width(); //I ended up having to separate out remaps for each side of the slider bar int bordw = map(analogRead(A0), 0, 1023, 0, 1023); int bordt = map(analogRead(A0), 0, 256, 0, myWidth); int bordrh = map(analogRead(A0), 256, 512, 0, myHeight); int bordb = map(analogRead(A0), 512, 768, myWidth, 0); int bordlh = map(analogRead(A0), 768, 1023, myHeight, 0); //below greyed out was used to figure out logic of slider bar for game 1 /* // top border if (1 < bordw < 256){ tft.fillRect(bordt, 0, 20, 5, WHITE); delay(100); tft.fillRect(0, 0, myWidth, 5, BLACK); } // right border if (257 < bordw < 512){ tft.fillRect(myWidth -5, bordrh, 5, 20, WHITE); delay(100); tft.fillRect(myWidth -5, 0, 5, myHeight, BLACK); } // bottom border if (512 < bordw < 768){ tft.fillRect(bordb, (myHeight - 5), 20, 5, WHITE); delay(100); tft.fillRect(0, (myHeight - 5), myWidth, 5, BLACK); } if (768 < bordw < 1023){ tft.fillRect(0, bordlh, 5, 20, WHITE); delay(100); tft.fillRect(0, 0, 5, myHeight, BLACK); } */ //test // after figuring out logic I tested to see if just simplifying and condensing the statements without if cases would work tft.fillRect(bordt, 0, 20, 5, WHITE); tft.fillRect(myWidth -5, bordrh, 5, 20, WHITE); tft.fillRect(bordb, (myHeight - 5), 20, 5, WHITE); tft.fillRect(0, bordlh, 5, 20, WHITE); delay(100); tft.fillRect(0, 0, 5, myHeight, BLACK); tft.fillRect(0, 0, myWidth, 5, BLACK); tft.fillRect(myWidth -5, 0, 5, myHeight, BLACK); tft.fillRect(0, (myHeight - 5), myWidth, 5, BLACK); } |
Author: | knoxvilles_joker [ Sat Jan 21, 2023 5:51 am ] |
Post subject: | |
I found that a 2.4" screen is the best fit. Unfortunately only a 16:9 format screen isntead of a 4:3 screen is an option. the TFT SPI displays do not have a 4:3 format option. |
Author: | knoxvilles_joker [ Sat Jan 21, 2023 9:29 am ] |
Post subject: | Re: security access tuner from alien isolation |
ok I got a random number generator set to use as a base for the sweet spot to transition from the initial game screen to the next one where you hack. I just have to sort out a logic issue with it. I will eventually move the main run loop diagnostics to a separate function that can be called back as I run through all the debugging of things. Code: /*Libraries provided by adafruit written by Lady Ada Fried. *Please stick to adafruit products as chinese knock offs are very, *very, very, problematic. * code for bar courtesy of: * https://forum.arduino.cc/t/tft-progress-bar-wont-go-back-down/989189 * some code pulled from isolation motion tracker pulled from: * https://www.instructables.com/Arduino-Motion-Tracker-From-Alien-Isolation/?fbclid=IwAR2P0H8tUwBisNGaP4C2vccz-fbBOlxxfdm8EIJJEHgAZnKOtgemeBjAZ3M * * * */ // Include the Bounce2 library found here : // https://github.com/thomasfredericks/Bounce2 #include <Bounce2.h> #include <SPI.h> #include "Adafruit_GFX.h" #include "Adafruit_ILI9341.h" #include <LcdProgressBar.h> #include <LiquidCrystal.h> // For the Adafruit shield, these are the default. #define TFT_MISO 8 #define TFT_DC 9 #define TFT_CS 10 #define TFT_MOSI 11 #define TFT_CLK 13 // Assign human-readable names to some common 16-bit color values: #define BLACK 0x0000 #define BLUE 0x001F #define RED 0xF800 #define GREEN 0x07E0 #define CYAN 0x07FF #define MAGENTA 0xF81F #define YELLOW 0xFFE0 #define WHITE 0xFFFF #define DARKGREEN 0x03E0 #define OLIVE 0x7BE0 #define GREENYELLOW 0xAFE5 // button pins #define BUTTON_PIN_1 18 #define BUTTON_PIN_2 19 // pot pins are pins 14 and 15 Bounce debouncer1 = Bounce(); Bounce debouncer2 = Bounce(); // integer declarations int rangelow; int rangehigh; int g1low = 50; int g1high = 50; int center; //TFT TFTscreen = TFT(cs, dc, rst); Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_MISO); void setup() { pinMode(A0, INPUT); tft.begin(); tft.fillScreen(BLACK); tft.setRotation(1); //this sets 0,0 as the top left corner txt(); boot1(); boot2(); // tft.setRotation(0); tft.fillScreen(BLACK); tft.setRotation(1); // button initialization pinMode(BUTTON_PIN_1,INPUT_PULLUP); debouncer1.attach(BUTTON_PIN_1); debouncer1.interval(5); pinMode(BUTTON_PIN_2,INPUT_PULLUP); debouncer2.attach(BUTTON_PIN_2); debouncer2.interval(25); // sets up random number generator for game1 to game 2 transition randomSeed(analogRead(A3)); center = random(150, 950); } void loop() { int myHeight = tft.height(); int myWidth = tft.width(); int bar = map(analogRead(A0), 0, 1023, 0, 308); tft.fillRect(6, 80, bar, 44, RED); tft.fillRect(bar, 80, 308 - bar, 44, BLACK); tft.fillRect(0, 20, myWidth, 5, BLACK); // draws pot number reading tft.setCursor(80,40); tft.setTextColor(RED); tft.setTextSize(3); tft.println(analogRead(A0)); // draws pot 2 number reading tft.setCursor(160,40); tft.setTextColor(RED); tft.setTextSize(3); tft.println(analogRead(A1)); // clears button status tft.fillRect(80, 140, 100, 30, BLACK); tft.fillRect(80, 180, 100, 30, BLACK); // add rendering pause delay(100); // clears drawings tft.fillRect(bar, 20, 20, 5, WHITE); tft.fillRect(80, 40, 200, 30, BLACK); game1(); //math for range sweetspot logic rangelow = center - g1low; rangehigh = center + g1high; if (rangelow < analogRead(A1) < rangehigh) { tft.fillRect(230, 40, 20, 20, OLIVE); } else {tft.fillRect(230, 40, 20, 20, BLACK);} // declarations for buttons debouncer1.update(); debouncer2.update(); int value1 = debouncer1.read(); int value2 = debouncer2.read(); // draws button 2 status tft.setCursor(160,140); tft.setTextColor(RED); tft.setTextSize(3); tft.println(value2); // draws button 1 status tft.setCursor(80,140); tft.setTextColor(OLIVE); tft.setTextSize(3); tft.println(value1); // draws button 2 status tft.setCursor(160,180); tft.setTextColor(OLIVE); tft.setTextSize(3); tft.println(rangelow); // draws button 1 status tft.setCursor(80,180); tft.setTextColor(OLIVE); tft.setTextSize(3); tft.println(rangehigh); // clears text } void txt() {//Starting :) tft.fillScreen(BLACK); tft.setCursor(60, 20); tft.setTextColor(WHITE); tft.setTextSize(5); tft.println("B2-LAB"); tft.setCursor(20, 80); tft.setTextColor(GREEN); tft.setTextSize(3); tft.println("MOTION-TRACKER"); tft.setCursor(10,130); tft.setTextColor(RED); tft.setTextSize(2); tft.println("^VERTICAL WHEN OPERATING^"); tft.setCursor(60, 150); tft.setTextColor(GREEN); tft.setTextSize(2); tft.print("Calibrate Sensors"); tft.setCursor(10, 170); tft.setTextSize(3); for(int i=0;i<4;i++) { tft.print("."); delay(1000); } } void boot1() { int myHeight = tft.height(); int myWidth = tft.width(); byte progress = myWidth/8; tft.fillScreen(BLACK); tft.setCursor(20, 10); tft.setTextColor(GREEN); tft.setTextSize(6); tft.println("SEEGSON"); tft.drawRect(myWidth/8, myHeight*3/5, myWidth/2, 50, GREEN); for(int i=0;i<40;i++) { tft.fillRect(myWidth/8, myHeight*3/5, progress, 50, GREEN); tft.setTextSize(2); tft.setCursor(10, 100); tft.print("Progress = "); tft.setTextSize(2); tft.setCursor(140, 100); tft.println(progress); delay(20); tft.fillRect(140, 100, 50, 20, BLACK); progress += 5; delay(300); } } void boot2() { tft.fillScreen(BLACK); int myHeight = tft.height(); int myWidth = tft.width(); tft.fillScreen(BLACK); tft.setCursor(myWidth*1/16, myHeight*9/12); tft.setTextColor(WHITE); tft.setTextSize(3); tft.print("Please wait"); tft.drawRect(myWidth/2, myHeight*1/5, 5, 20, WHITE); delay(200); tft.drawRect(myWidth/2, myHeight*1/5, 5, 20, BLACK); tft.drawLine(myWidth*7/16, myHeight*3/12, myWidth*9/16, myHeight*1/12, WHITE); delay(200); tft.drawLine(myWidth*7/16, myHeight*3/12, myWidth*9/16, myHeight*1/12, BLACK); } void game2() { int myHeight = tft.height(); int myWidth = tft.width(); } void game1() { int myHeight = tft.height(); int myWidth = tft.width(); //I ended up having to separate out remaps for each side of the slider bar int bordw = map(analogRead(A0), 0, 1023, 0, 1023); int bordt = map(analogRead(A0), 0, 256, 0, myWidth); int bordrh = map(analogRead(A0), 256, 512, 0, myHeight); int bordb = map(analogRead(A0), 512, 768, myWidth, 0); int bordlh = map(analogRead(A0), 768, 1023, myHeight, 0); //below greyed out was used to figure out logic of slider bar for game 1 /* // top border if (1 < bordw < 256){ tft.fillRect(bordt, 0, 20, 5, WHITE); delay(100); tft.fillRect(0, 0, myWidth, 5, BLACK); } // right border if (257 < bordw < 512){ tft.fillRect(myWidth -5, bordrh, 5, 20, WHITE); delay(100); tft.fillRect(myWidth -5, 0, 5, myHeight, BLACK); } // bottom border if (512 < bordw < 768){ tft.fillRect(bordb, (myHeight - 5), 20, 5, WHITE); delay(100); tft.fillRect(0, (myHeight - 5), myWidth, 5, BLACK); } if (768 < bordw < 1023){ tft.fillRect(0, bordlh, 5, 20, WHITE); delay(100); tft.fillRect(0, 0, 5, myHeight, BLACK); } */ //test // after figuring out logic I tested to see if just simplifying and condensing the statements without if cases would work tft.fillRect(bordt, 0, 20, 5, WHITE); tft.fillRect(myWidth -5, bordrh, 5, 20, WHITE); tft.fillRect(bordb, (myHeight - 5), 20, 5, WHITE); tft.fillRect(0, bordlh, 5, 20, WHITE); delay(100); tft.fillRect(0, 0, 5, myHeight, BLACK); tft.fillRect(0, 0, myWidth, 5, BLACK); tft.fillRect(myWidth -5, 0, 5, myHeight, BLACK); tft.fillRect(0, (myHeight - 5), myWidth, 5, BLACK); } |
Author: | knoxvilles_joker [ Sat Jan 21, 2023 10:36 pm ] |
Post subject: | |
https://youtu.be/AJqgc13dK7I in process still have a ways to go. |
Author: | knoxvilles_joker [ Sun Jan 22, 2023 2:22 am ] |
Post subject: | |
I got the logic working for the second game. I had to use a specific invocation of if for a between pulling the current value from the active reading of the potentiometer if (rangelow < analogRead(A0) && < analogRead(A0) < rangehigh) { tft.fillRect(230, 40, 20, 20, OLIVE); } FYI this is standard programming for c## for a between range The documentation on doing this was rather lacking so it took a good while to figure this one out. The key is to draw the current value from the potentiometer. a stored value would not work The other thing to note is that the range of 100 units that is the sweet spot to enter into the next game piece is random each time the unit reboots. And I have the random value mapped or constrained to be within the values the potentiometer would put out normally. I posted on this on the arduino forums as it is not really documented anywhere https://forum.arduino.cc/t/fyi-if-you-a ... on/1080713 |
Author: | knoxvilles_joker [ Sun Jan 22, 2023 3:49 am ] |
Post subject: | |
OK to get the colors picked more accurately, I had to reference a couple of color picker sites. the library reads colors in 16bits(RGB565) instead of 24bits(RGB888). So to find the color in rgb888 go to: https://imagecolorpicker.com/en to get it converted to a 16 bit value go to: http://www.barth-dev.de/online/rgb565-color-picker/ |
Author: | knoxvilles_joker [ Sun Jan 22, 2023 4:09 am ] |
Post subject: | Re: security access tuner from alien isolation |
OK did some updates Code: /*Libraries provided by adafruit written by Lady Ada Fried.
*Please stick to adafruit products as chinese knock offs are very, *very, very, problematic. * code for bar courtesy of: * https://forum.arduino.cc/t/tft-progress-bar-wont-go-back-down/989189 * some code pulled from isolation motion tracker pulled from: * https://www.instructables.com/Arduino-Motion-Tracker-From-Alien-Isolation/?fbclid=IwAR2P0H8tUwBisNGaP4C2vccz-fbBOlxxfdm8EIJJEHgAZnKOtgemeBjAZ3M * help found on arduino forums at https://arduino.cc * * */ // Include the Bounce2 library found here : // https://github.com/thomasfredericks/Bounce2 #include <Bounce2.h> #include <SPI.h> #include "Adafruit_GFX.h" #include "Adafruit_ILI9341.h" #include <LcdProgressBar.h> #include <LiquidCrystal.h> // For the Adafruit shield, these are the default. #define TFT_MISO 8 #define TFT_DC 9 #define TFT_CS 10 #define TFT_MOSI 11 #define TFT_CLK 13 // the colors are in a RGB565 format, so to get it you first need to grab it as a RGB888 and convert //go here //https://imagecolorpicker.com/en //then here //http://www.barth-dev.de/online/rgb565-color-picker/ // Assign human-readable names to some common 16-bit color values: #define BLACK 0x0000 #define BLUE 0x001F #define RED 0xF800 #define GREEN 0x07E0 #define CYAN 0x07FF #define MAGENTA 0xF81F #define YELLOW 0xFFE0 #define WHITE 0xFFFF #define DARKGREEN 0x03E0 #define OLIVE 0x7BE0 #define GREENYELLOW 0xAFE5 #define TEAL 0x263F // button pins #define BUTTON_PIN_1 18 #define BUTTON_PIN_2 19 // pot pins are pins 14 and 15 Bounce debouncer1 = Bounce(); Bounce debouncer2 = Bounce(); // integer declarations int rangelow; int rangehigh; int g1low = 50; int g1high = 50; int center; //TFT TFTscreen = TFT(cs, dc, rst); Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_MISO); void setup() { pinMode(A0, INPUT); tft.begin(); tft.fillScreen(BLACK); tft.setRotation(1); //this sets 0,0 as the top left corner txt(); boot1(); boot2(); // tft.setRotation(0); tft.fillScreen(BLACK); tft.setRotation(1); // button initialization pinMode(BUTTON_PIN_1,INPUT_PULLUP); debouncer1.attach(BUTTON_PIN_1); debouncer1.interval(5); pinMode(BUTTON_PIN_2,INPUT_PULLUP); debouncer2.attach(BUTTON_PIN_2); debouncer2.interval(25); // sets up random number generator for game1 to game 2 transition randomSeed(analogRead(A3)); center = random(150, 950); int myHeight = tft.height(); int myWidth = tft.width(); } void loop() { // int myHeight = tft.height(); //int myWidth = tft.width(); // int bar = map(analogRead(A0), 0, 1023, 0, 308); //math for range sweetspot logic, center is declared in setup rangelow = center - g1low; rangehigh = center + g1high; // comment out the bottom two lines and replace them with the below line to aid in calibrating your setup // calibration(); if (rangelow < analogRead(A0) && < analogRead(A0) < rangehigh) { game2();} // tft.fillRect(230, 40, 20, 20, OLIVE); } else { game1(); } //tft.fillRect(230, 40, 20, 20, BLACK);} // declarations for buttons debouncer1.update(); debouncer2.update(); int value1 = debouncer1.read(); int value2 = debouncer2.read(); delay(100); } calibration() { int myHeight = tft.height(); int myWidth = tft.width(); int bar = map(analogRead(A0), 0, 1023, 0, 308); tft.fillRect(6, 80, bar, 44, RED); tft.fillRect(bar, 80, 308 - bar, 44, BLACK); tft.fillRect(0, 20, myWidth, 5, BLACK); // draws pot number reading tft.setCursor(80,40); tft.setTextColor(RED); tft.setTextSize(3); tft.println(analogRead(A0)); // draws pot 2 number reading tft.setCursor(160,40); tft.setTextColor(RED); tft.setTextSize(3); tft.println(analogRead(A1)); // clears button status tft.fillRect(80, 140, 100, 30, BLACK); tft.fillRect(80, 180, 100, 30, BLACK); // add rendering pause delay(100); // clears drawings tft.fillRect(bar, 20, 20, 5, WHITE); tft.fillRect(80, 40, 200, 30, BLACK); game1(); //math for range sweetspot logic rangelow = center - g1low; rangehigh = center + g1high; if (rangelow < analogRead(A0) && < analogRead(A0) < rangehigh) { tft.fillRect(230, 40, 20, 20, OLIVE); } else {tft.fillRect(230, 40, 20, 20, BLACK);} // declarations for buttons debouncer1.update(); debouncer2.update(); int value1 = debouncer1.read(); int value2 = debouncer2.read(); // draws button 2 status tft.setCursor(160,140); tft.setTextColor(RED); tft.setTextSize(3); tft.println(value2); // draws button 1 status tft.setCursor(80,140); tft.setTextColor(OLIVE); tft.setTextSize(3); tft.println(value1); // draws button 2 status tft.setCursor(160,180); tft.setTextColor(OLIVE); tft.setTextSize(3); tft.println(rangelow); // draws button 1 status tft.setCursor(80,180); tft.setTextColor(OLIVE); tft.setTextSize(3); tft.println(rangehigh); // clears text } void txt() {//Starting :) tft.fillScreen(BLACK); tft.setCursor(60, 20); tft.setTextColor(WHITE); tft.setTextSize(5); tft.println("B2-LAB"); tft.setCursor(20, 80); tft.setTextColor(GREEN); tft.setTextSize(3); tft.println("MOTION-TRACKER"); tft.setCursor(10,130); tft.setTextColor(RED); tft.setTextSize(2); tft.println("^VERTICAL WHEN OPERATING^"); tft.setCursor(60, 150); tft.setTextColor(GREEN); tft.setTextSize(2); tft.print("Calibrate Sensors"); tft.setCursor(10, 170); tft.setTextSize(3); for(int i=0;i<4;i++) { tft.print("."); delay(1000); } } void boot1() { int myHeight = tft.height(); int myWidth = tft.width(); byte progress = myWidth/8; tft.fillScreen(BLACK); tft.setCursor(20, 10); tft.setTextColor(GREEN); tft.setTextSize(6); tft.println("SEEGSON"); tft.drawRect(myWidth/8, myHeight*3/5, myWidth/2, 50, GREEN); for(int i=0;i<40;i++) { tft.fillRect(myWidth/8, myHeight*3/5, progress, 50, GREEN); tft.setTextSize(2); tft.setCursor(10, 100); tft.print("Progress = "); tft.setTextSize(2); tft.setCursor(140, 100); tft.println(progress); delay(20); tft.fillRect(140, 100, 50, 20, BLACK); progress += 5; delay(300); } } void boot2() { tft.fillScreen(BLACK); int myHeight = tft.height(); int myWidth = tft.width(); tft.fillScreen(BLACK); tft.setCursor(myWidth*1/16, myHeight*9/12); tft.setTextColor(WHITE); tft.setTextSize(3); tft.print("Please wait"); tft.drawRect(myWidth/2, myHeight*1/5, 5, 20, WHITE); delay(200); tft.drawRect(myWidth/2, myHeight*1/5, 5, 20, BLACK); tft.drawLine(myWidth*7/16, myHeight*3/12, myWidth*9/16, myHeight*1/12, WHITE); delay(200); tft.drawLine(myWidth*7/16, myHeight*3/12, myWidth*9/16, myHeight*1/12, BLACK); } void game2() { int myHeight = tft.height(); int myWidth = tft.width(); // MAKES BACKGROUND tft.fillScreen(TEAL); // sets text static display pieces tft.setCursor(myWidth*2/16, myHeight*1/12); tft.setTextColor(WHITE); tft.setTextSize(2); tft.print("SYSTEM OVERRIDE"); tft.setCursor(myWidth*3/16, myHeight*11/12); tft.setTextColor(WHITE); tft.setTextSize(1); tft.print("SECURITY FREQUENCY MATCH"); tft.setCursor(myWidth*3/16, myHeight*12/12-6); tft.setTextColor(WHITE); tft.setTextSize(1); tft.print("V2.34 SYSTEM TEST"); // the minigame border tft.drawRect(3, myHeight*3/12, myWidth-6, myHeight*6/12, WHITE); tft.drawRect(6, myHeight*3/12, myWidth-9, myHeight*6/12, WHITE); } void game1() { int myHeight = tft.height(); int myWidth = tft.width(); //I ended up having to separate out remaps for each side of the slider bar int bordw = map(analogRead(A0), 0, 1023, 0, 1023); int bordt = map(analogRead(A0), 0, 256, 0, myWidth); int bordrh = map(analogRead(A0), 256, 512, 0, myHeight); int bordb = map(analogRead(A0), 512, 768, myWidth, 0); int bordlh = map(analogRead(A0), 768, 1023, myHeight, 0); //below greyed out was used to figure out logic of slider bar for game 1 /* // top border, right, bottom, left border bar if (1 < bordw < 256){ tft.fillRect(bordt, 0, 20, 5, WHITE); delay(100); tft.fillRect(0, 0, myWidth, 5, BLACK); } if (257 < bordw < 512){ tft.fillRect(myWidth -5, bordrh, 5, 20, WHITE); delay(100); tft.fillRect(myWidth -5, 0, 5, myHeight, BLACK); } if (512 < bordw < 768){ tft.fillRect(bordb, (myHeight - 5), 20, 5, WHITE); delay(100); tft.fillRect(0, (myHeight - 5), myWidth, 5, BLACK); } if (768 < bordw < 1023){ tft.fillRect(0, bordlh, 5, 20, WHITE); delay(100); tft.fillRect(0, 0, 5, myHeight, BLACK); } */ // after figuring out logic I tested to see if just simplifying and condensing the statements without if cases would work (it worked.) tft.fillRect(bordt, 0, 20, 5, WHITE); tft.fillRect(myWidth -5, bordrh, 5, 20, WHITE); tft.fillRect(bordb, (myHeight - 5), 20, 5, WHITE); tft.fillRect(0, bordlh, 5, 20, WHITE); delay(50); tft.fillRect(0, 0, 5, myHeight, BLACK); tft.fillRect(0, 0, myWidth, 5, BLACK); tft.fillRect(myWidth -5, 0, 5, myHeight, BLACK); tft.fillRect(0, (myHeight - 5), myWidth, 5, BLACK); } |
Author: | knoxvilles_joker [ Sun Jan 29, 2023 6:02 am ] |
Post subject: | |
Coding is going slowly. |
Page 1 of 3 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |