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> | |
Servo lArm; | |
Servo rArm; | |
Servo lLeg; | |
Servo rLeg; | |
int lArmPos = 0; | |
int lLegPos = 0; | |
int rArmPos = 0; |
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
//: Control/Ex10:NumerosVampiro.java | |
public class VampireNumbers { | |
static int TwoDigitsGuessFirst(int n){ | |
int o, p; | |
o = n / 10; | |
n = n % 10; | |
p = n / 1; | |
return o; |
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> // Agregamos librerias del servo. | |
#include <SPI.h> // Nos permite conectar varias placas de arduino. | |
#include <WiFi.h> // Añadimos librerias del WiFi. | |
// Definimos las letras que leera nuestro programa: | |
#define ADELANTE 'w' | |
#define IZQUIERDA 'a' | |
#define DERECHA 'd' | |
#define REVERSA 's' | |
#define SUBE_BRAZO 'e' | |
#define BAJA_BRAZO 'r' |
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
import RPi.GPIO as GPIO | |
import time | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(18, GPIO.OUT) | |
GPIO.setup(15, GPIO.OUT) | |
P1 = GPIO.PWM(18, 100) | |
P2 = GPIO.PWM(15, 100) | |
P1.start(5) |
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 <termios.h> | |
#include <fcntl.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <errno.h> | |
int | |
set_interface_attribs (char fd, int speed, int parity) | |
{ | |
struct termios tty; |
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
name = input("Give me your name: ") | |
print ("Hi " + name + "!") | |
age = int(input("Give me your age: ")) | |
res = 100 - age | |
year = 2017 + res | |
print("You will turn 100 years in the year " + str(year)) | |
number = int(input("Enter a number: ")) | |
print("Your number is: ") | |
print(10 * str(number)) |
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
while True: | |
number = int(input("Give me a number: ")) | |
mod = number % 2 | |
## extra 1 | |
multiple_of_four = number % 4 | |
if multiple_of_four == 0: | |
print("Your number is multiple of four!") | |
elif mod == 0: | |
print("Your number is odd!") | |
else: |
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
a = [54, 3, 8, 2, 432, 5, 0, 47, 7, 2, 3, 55, 86, 58] | |
x = [] | |
for element in a: | |
if element < 5: | |
print(element) | |
x.append(element) | |
## Extra 1 | |
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
number = int(input("Give a number: ")) | |
x = range(1, number + 1) | |
for element in x: | |
divisor = number % element | |
if divisor == 0: | |
print(str(element) + " is a divisor of " + str(number)) |
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
import random | |
a = [] | |
b = [] | |
c = [] | |
while len(a) < 10: | |
x = random.randint(0, 11) | |
y = random.randint(0, 11) | |
a.append(x) | |
b.append(y) |
NewerOlder