evive 3V3 Input Output Example Code by STEMpedia

This code demonstrate the use of bidirectional logic shifter as 3.3V digital output and input.

Introduction

evive has two bidirectional logic level shifters which are accessible from digital pin 36 and 37 in Arduino IDE and the flow of direction is controlled by digital pin 33. evive uses 74LVC245 for level shifting.

Programming in Arduino IDE

By changing the state of digital pin 33, you can change the characteristics of the logic shifter as an input or output. If the state of digital pin 33 is HIGH, then the IO3V3 pins act as OUTPUT pins, but if the state is LOW, then they act like INPUT pins. The digital pin 33 should always be configured as the output.

Digital pins 36 and 37 are directly connected to the level shifter. Level shifter takes 5V input and output from the digital pins and converts them to 3.3V I/O. This 3.3V I/O pins are shown in the figure. If you want to give 3.3V output from these pins then you have to configure digital pins 36 and 37 as OUTPUT pins in Arduino IDE. You can use IO3V3 pins as input anytime without configuring them as INPUT or OUTPUT. But you have to change the state of digital pin 33 to LOW before reading.

Embed This Sketch

Use the following HTML code to embed the sketch code above in your blog or website.

<iframe style="height: 510px; width: 100%; margin: 10px 0 10px;" allowTransparency="true" src="https://codebender.cc/embed/sketch:759733" frameborder="0"></iframe>

Embed The Serial Monitor

You can also embed the Serial Monitor section! Just use this HTML code.

<iframe style="height: 510px; width: 100%; margin: 10px 0 10px;" allowTransparency="true" src="https://codebender.cc/embed/serialmonitor" frameborder="0"></iframe>