# Simple Electronic Circuits

In this section we will have simple tutorials of building electronic circuits and interfacing them with a microprocessor

The examples will have code and wiring for both Arduinos and Picos.

## Debugging Circuits and code

A problem you can face with combining microprocessor code with electronic circuits is **Where** is the fault, code or circuit?

Here are some hints on how to solve this:

1. Remember that to provide a voltage you must **COMPLETE THE CIRCUIT**. 
    * There must be a voltage in (either from a GPIO or a voltage out) and it must go to ground. Though never connect the voltage pins directly to ground, this will pull too much current through the microprocessor. Make sure a component is in the circuit to limit the current

```{image} images/simple_circuit.png
:class: bg-primary mb-1
:width: 500px
:align: center
```
This images shows a simple circuit, note how it is completed


1. Simplify the circuit. 
    * For example, if trying to light an LED take the 3.3V output directly to power the LED instead of from a GPIO.If it doesn't light then trouble shoot. Check the LED is the right way around, check everything is inserted correctly etc...

2. Simplify the code. 
    * Make simple version of the code to check it interacts with the circuit correctly. Build back up the complexity