This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Servo.h> | |
#include <NewPing.h> | |
#define TRIGGER_PIN 12 // Arduino pin tied to trigger pin on the ultrasonic sensor. | |
#define ECHO_PIN 11 // Arduino pin tied to echo pin on the ultrasonic sensor. | |
#define MAX_DISTANCE 200// Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm. | |
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance. | |
Servo myservo; // create servo object to control a servo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <NewPing.h> | |
#include <Servo.h> | |
#define TRIGGER_PIN 13 | |
#define ECHO_PIN 12 | |
#define MAX_DISTANCE 50 | |
#define TimeDelayServo 200 | |
int pos; //Position Servo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define PinBuzzer 7 | |
#define SoundTime 2000 | |
#define PinSignal 8 | |
void setup() { | |
pinMode(PinBuzzer, OUTPUT); | |
pinMode(PinSignal, INPUT); | |
} | |
void loop() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define Led_full 7 | |
#define Led_Eighty_percent 6 | |
#define Led_medium 5 | |
#define Led_minimun 4 | |
#define Battery 0 | |
#define Delay_ON_OFF 1500 | |
float BatteryVoltage = 0; | |
const float full = 1.5; | |
const float Eighty_percent= 1.2; //Greater than 80 percent | |
const float medium= 0.9; //60 percent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frutas = ["fresa", "piña", "cereza"] | |
for x in frutas: | |
print(x) | |
for x in "cereza": | |
print(x) | |
frutas = ["fresa", "piña", "cereza", "sandía", "melón"] | |
for x in frutas: | |
print(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = 1 | |
while x < 6: | |
print(x) | |
x += 1 | |
print("Terminé de contar!") | |
x = 1 | |
while x < 6: | |
print(x) | |
if x == 3: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nombre = input("Hola, ¿Cuál es tu nombre? ") | |
print("Mucho gusto,", nombre) | |
edad = input("Ingresa tu edad ") | |
edad = (int (edad)) | |
print("Tu edad es: ", edad, "años.") | |
num = int(input("Ingresa un número ")) | |
print("El número es: ", num,) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Esto es una estructura if | |
a = 40 | |
b = 200 | |
if b > a: | |
print("b es mayor que a") | |
a = 15 | |
b = 15 | |
if b > a: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diccionario = { | |
"Marca" : "Ford", | |
"Modelo" : "Mustang", | |
"Año" : 1964 | |
} | |
print(diccionario) | |
x = diccionario ["Modelo"] | |
print(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set_frutas = {"fresa", "piña", "cereza"} | |
print(set_frutas) | |
set_frutas = {"fresa", "piña", "cereza"} | |
for x in set_frutas: | |
print(x) | |
print("piña" in set_frutas) | |
set_frutas = {"fresa", "piña", "cereza"} |