In Arduino, I'm trying to combine the 8-bit binary numbers/strings from two PISO (parallel in - series out) shift registers into one 16-bit binary string. The binary numbers stored on a variable (switchVar1) with the shiftIn() command on Arduino switchVar1 = shiftIn(dataPin, clockPin);
switchVar1 was first defined by byte switchVar1 = 72;.
I'm doing this so I can then read the binary string with the switch() function and do different combinations as I have 16 contacts/buttons where different combinations of all the 16 buttons will be defined so I need a string of 16-bit binary number.
Basically, I'm asking how to turn two 8-bit binary number arrays into one single array.
Keep in mind, I'm completely new to c++ so there might be some basic solution that I probably didn't think of.
How do I combine two arrays of 8 bits each (binary number strings into one single string with 16 bits? (arduino, shift registers)
499 views Asked by N. Ope At
2
There are 2 answers
Related Questions in C++
- How to immediately apply DISPLAYCONFIG_SCALING display scaling mode with SetDisplayConfig and DISPLAYCONFIG_PATH_TARGET_INFO
- Why can't I use templates members in its specialization?
- How to fix "Access violation executing location" when using GLFW and GLAD
- Dynamic array of structures in C++/ cannot fill a dynamic array of doubles in structure from dynamic array of structures
- How do I apply the interface concept with the base-class in design?
- File refuses to compile std::erase() even if using -std=g++23
- How can I do a successful map when the number of elements to be mapped is not consistent in Thrust C++
- Can std::bit_cast be applied to an empty object?
- Unexpected inter-thread happens-before relationships from relaxed memory ordering
- How i can move element of dynamic vector in argument of function push_back for dynamic vector
- Brick Breaker Ball Bounce
- Thread-safe lock-free min where both operands can change c++
- Watchdog Timer Reset on ESP32 using Webservers
- How to solve compiler error: no matching function for call to 'dmhFS::dmhFS()' in my case?
- Conda CMAKE CXX Compiler error while compiling Pytorch
Related Questions in ARRAYS
- How could you print a specific String from an array with the values of an array from a double array on the same line, using iteration to print all?
- What does: "char *argv[]" mean?
- How to populate two dimensional array
- User input sanitization program, which takes a specific amount of arguments and passes the execution to a bash script
- Function is returning undefined but should be returning a matched object from array in JavaScript
- The rules of Conway's Game of Life aren't working in my Javascript version. What am I doing wrong?
- Array related question, cant find the pattern
- Setting the counter (j) for (inner for loop)
- I want to flip an image (with three channels RGB) horizontally just using array slicing. How can I do it with python?
- Numpy array methods are faster than numpy functions?
- How to enter data in mongodb array at specific position such that if there is only 2 data in array and I want to insert at 5, then rest data is null
- How to return array to ArrayPool when it was rented by inner function?
- best way to remove a word from an array in a react app
- Vue display output of two dimensional array
- Undot Array with Wildcards in Laravel
Related Questions in ARDUINO
- How to fix python serial monitor parsing error?
- How can I break bricks?
- Soft WDT reset on Wemos D1 Mini
- Arduino TFT module 240x320 OLED not working
- Async Web Server RP2040 returning ERR_CONNECTION_REFUSED?
- ESP32 Consequtive Interrupt WDT Timeout Exception
- Adafruit BNO08x Lib Not working with PicoRP2040 - PlatformIO
- SPI - R/W to ST95P08 EEPROM
- arduino disambungkan ke konputer nyala dan mati lagi
- How to correctly read POST REQUEST body on ESP32?
- How do I publish sensor data to EMQX broker on Ubuntu from a remote Arduino (no WiFi) interfaced with SIM800L?
- Portenta H7 Baremetal Development and a Little Guidance on Embedded System Learning Roadmap
- Wifi disconnects and connects again and again while using esp8266, max30100 and oled display
- Arduino-cli commands are not found in vscode using WSL, why is this occuring?
- Implementing Image Processing for Dimension Measurement in Arduino-based Packaging System
Related Questions in C-STRINGS
- I need to create a malloc array of strings and print those strings out
- Is there a worked example of using CStrBufT with a CString?
- Function is returning null instead of array in C
- Nested strtok() calls to tokenize given string does not work as expected
- Looping through an array which contains a string with spaces
- Word Count in C
- Last character index of inverted string in C being the whole uninverted original string
- sprintf blocks stm32 program
- Calling SHGetKnownFolderPath from Python?
- Invalid Initialization of Non-Const Reference Error in C++
- Is this a legal C strdup function?
- TextBox String to open file
- How to pass a string to a function and return the same string changed in C?
- How to shift chars in a character array without a temp?
- How do I convert a long string into a smaller abbreviation consisting of the first character, last character and number of chars in between?
Related Questions in SHIFT-REGISTER
- 74HC595 Shift register with Arduino
- changing specific bits of data in a single byte of data
- Problem using SevSegShift library with ESP32 and 74HC595
- why my shift register show the result in one clock instead of 4?
- Change LED intencity through 74HC595 shift register
- Communication to parallel (not cascade) 74hc595 over common bus lines
- Controlling 8-digit 7-segment displays using 74HC595 using Raspberry Pi Python
- How do I combine two arrays of 8 bits each (binary number strings into one single string with 16 bits? (arduino, shift registers)
- Shift register stops working after I send one piece of code with my arduino
- C - BYTE manipulation for display
- Why does Verilog output show x and z instead of zero and 1?
- 1-cycle enable signal in a clocked process
- VHDL: (Data Flow and Control Unit) calculate log2, represented as an unsigned 8-bit integer
- error: assignment of function 'void digitalWrite(uint8_t, uint8_t)
- Shift Register not working in Verilog HDL
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
It got figured out with thanks to everyone commenting. So I just did it like:
switchVar1 = shiftIn(dataPin, clockPin); switchVar2 = shiftIn(dataPin2, clockPin2); uint16_t switchVariable = switchVar1 | (switchVar2<<8);as in I first created two, byte files and "shifted" the numbers on one (switchVar2) 8 steps to the left (to be literal) (with the<<bitwise operator) and added both together with the bitwise OR operator (the pipe symbol |) in oneuint16_tvariable type. Then I just read all the combinations with theswitch() casecommand. (Also, I'm stupidly new to programming languages in general, and saying "arrays" was my bad.)