# How to do the same as "uint16\_t read\_data\[8192\];" in Processing?

**URL:** <https://discourse.processing.org/t/how-to-do-the-same-as-uint16-t-read-data-8192-in-processing/31891>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [August 24, 2021, 4:08pm UTC](https://discourse.processing.org/t/how-to-do-the-same-as-uint16-t-read-data-8192-in-processing/31891 "2021-08-24T16:08:57Z")\
**Posts on this page:** 1\
**Showing post:** 22

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [August 25, 2021, 12:25am UTC](https://discourse.processing.org/t/how-to-do-the-same-as-uint16-t-read-data-8192-in-processing/31891/22 "2021-08-25T00:25:44Z")

</div>

Hello @jhsa ,

I was a bit fiddler in my heyday!

```auto
void setup()
  {
  for(int i=0; i<16; i++)
    {
    print(bitRead(0xAA55, i));
    }
  println();
  println(binary(0xAA55, 16));  
    
  println();
  int bTest = 0xFF00;
  println(binary(bTest, 16));
  bTest = bitSet(bTest, 1);
  println(binary(bTest, 16));
  bTest = bitClear(bTest, 14);
  println(binary(bTest, 16));
  }

int bitRead(int b, int bitPos)
      {
      int x = b & (1 << bitPos);
      return x == 0 ? 0 : 1;
      }
      
int bitSet(int b, int bitPos)
      {
      int x = b | (1 << bitPos);
      return x;
      }
      
int bitClear(int b, int bitPos)
      {
      int x = b & ~(1 << bitPos);
      return x;
      }       

```

It may need some testing and tweaking! A bit late for me to be coding.

`:)`

---

_[View the full topic](https://discourse.processing.org/t/how-to-do-the-same-as-uint16-t-read-data-8192-in-processing/31891)._
