CARVIEW |
Select Language
HTTP/2 200
date: Mon, 13 Oct 2025 11:16:06 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=a23bfa96e636a84159de81ae2cafa55e47e883d927e738586a0539b36f591a6ea%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22qTo5QwigsIa82sz0Zr2eeOwOTEfuvuOm%22%3B%7D; HttpOnly; Path=/
cf-ray: 98de6c435f0b9dfd-BLR
_7seg_test.cpp - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // For later
- const int W_H = 1;
- const int W_L = 0;
- const int M_O = 1;
- const int M_I = 0;
- // MAX PINS
- const int MAX_PINS = 12;
- // Hold pin info
- struct {
- int m;
- int w;
- int number;
- } pins[12];
- // Characters for pin commands
- char pin_number = 'x';
- char pin_action = 'x';
- char pin_chars[MAX_PINS] = {'2','3','4','5','6','7','8','9','A','B','C','D'};
- void setup() {
- // Initialize pins and struct
- for (int pc=0; pc < MAX_PINS; pc++) {
- int temp_pin = pc + 2;
- pinMode(temp_pin, INPUT);
- pins[pc].m = M_I;
- pins[pc].w = W_L;
- pins[pc].number = temp_pin;
- }
- // Start serial
- Serial.begin(9600);
- while(!Serial) { ; }
- }
- void loop() {
- // Check for incoming bits that are looking for the controller
- if (Serial.available() > 0) {
- char c = Serial.read();
- if (pin_number == 'x') {
- pin_number = c;
- }
- else if (pin_action == 'x') {
- pin_action = c;
- }
- }
- // If you have enough, go
- if (pin_number != 'x' && pin_action != 'x') {
- goCommand();
- }
- // Pause
- delay(100);
- }
- int findPin(int pin) {
- for(int cnt=0; cnt < MAX_PINS; cnt++) {
- if (pin == pins[cnt].number) {
- return cnt;
- }
- }
- return 99;
- }
- int findPinFromChar() {
- for (int cnt = 0; cnt < MAX_PINS; cnt++) {
- if (pin_chars[cnt] == pin_number) {
- return cnt;
- }
- }
- return 99;
- }
- void switchMode(int pin) {
- int c = findPin(pin);
- if (c >= MAX_PINS) { return; }
- if (pins[c].m == M_O) {
- pinMode(pins[c].number, INPUT);
- pins[c].m = M_I;
- } else {
- pinMode(pins[c].number, OUTPUT);
- pins[c].m = M_O;
- }
- }
- void switchWrite(int pin) {
- int c = findPin(pin);
- if (c >= MAX_PINS) { return; }
- if (pins[c].m == M_I) { return; }
- if (pins[c].w == W_H) {
- digitalWrite(pins[c].number, LOW);
- pins[c].w = W_L;
- } else {
- digitalWrite(pins[c].number, HIGH);
- pins[c].w = W_H;
- }
- }
- void feedBack() {
- int p = findPinFromChar();
- if (p == 99) return;
- int pmw = pins[p].m + (pins[p].w * 2);
- Serial.print(pin_chars[p]);
- Serial.print(pmw, DEC);
- }
- void resetChars() {
- pin_number = 'x';
- pin_action = 'x';
- }
- void goCommand() {
- if (pin_action != 'M' && pin_action != 'W') { resetChars(); return; }
- int p = findPinFromChar();
- if (p >= MAX_PINS) { resetChars(); return; }
- if (pin_action == 'M') {
- switchMode(pins[p].number);
- }
- if (pin_action == 'W') {
- switchWrite(pins[p].number);
- }
- feedBack();
- resetChars();
- }
Advertisement
Add Comment
Please, Sign In to add comment
-
π Swapzone +37% glitch β 5
JavaScript | 8 sec ago | 0.25 KB
-
π ChangeNOW Exploit
JavaScript | 9 sec ago | 0.24 KB
-
β
β Make huge profits on trading ββ T
JavaScript | 17 sec ago | 0.25 KB
-
π ChangeNOW Exploit
JavaScript | 22 sec ago | 0.24 KB
-
β
Marketplace Glitch β
Working NEVER SEEN BE...
JavaScript | 25 sec ago | 0.25 KB
-
π Swapzone +37% glitch
JavaScript | 31 sec ago | 0.24 KB
-
ββ
Exploit 2500$ in 15 Minutesβββ H
JavaScript | 33 sec ago | 0.25 KB
-
π EASY MONEY GUIDE β
Working R
JavaScript | 41 sec ago | 0.25 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand