Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can you please help me understand this code better , I have some problems according left shft and right shift operands when it comes to

can you please help me understand this code better , I have some problems according left shft and right shift operands when it comes to setting bits

I have understood that const byte pin11 = 0x1 << PBit; // bit 3 means to set bit 3 to 1 but what is v = (PINB & pin11) >> PBit; // sense voltage at pin 11?

can you let me know how to understand setting bits.

#define PBit 3

 const byte pin11 = 0x1 << PBit; // bit 3 
 void setup() { DDRB &= ~pin11; // config pin 11 as digital input PORTB &= ~pin11; // disable pull-up Serial.begin(9600); // open serial port to host 

}

 void loop() { int v; 
 v = (PINB & pin11) >> PBit; // sense voltage at pin 11 

}

Serial.println(v); delay(100); 
// send voltage to host // wait 100ms 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions

Question

How does the concept of hegemony relate to culture?

Answered: 1 week ago

Question

Lo6 Identify several management development methods.

Answered: 1 week ago