//
Digital output
const int outPin=3;
void setup(){
pinMode (outPin, OUTPUT);
Serial.begin (9600);
Serial.printlin ("Enter 1 or 0");}
void loop(){
if (Serial.avaiable()>0)}
char ch=Serial.read
if (ch='1'){
digitalWrite (outPin, HIGH);}
else if (ch= ='0'){
digitalWrite (outPin, LOW);}
}}
Digital input
const int inputPin=5;
void setup(){
pinMode (inputtPin, INPUT);
Serial.begin (9600);
void loop(){
int reading= digitalRead (inputPin)}
Serial.println (reading);
delay (1000);}
Analog output
const int outPin=3;
void setup(){
pinMode (outPin, OUTPUT;
Serial.begin (9600);
Serial.println ("Entre Volts: 0-5");}
void loop(){
if (Serial.avaiable > 0){
float volts = Serial.parseFloat();
int pwmValue = volts *255.0/5.0;
analogWrite (outputPin, pwmValue);}}
Analog input
const int analogPin=A0;
void setup(){
Serial.begin (9600);}
void loop(){
int reading= analogRead (analogPin);
float voltage = reading/204.6;
Serial.println ("Reading");
Serial.print (reading);
Serial.print ("\t\tVolt=");
Serial.println (voltage);
delay (500);}