Skip to content

Instantly share code, notes, and snippets.

View GreggX's full-sized avatar
🎯
Focusing

Gregorio González GreggX

🎯
Focusing
  • Guadalajara, MX
View GitHub Profile
@GreggX
GreggX / servo_joystick_controller.ino
Created December 22, 2019 16:02
Simple servo/joystick controller
#include <Servo.h>
Servo lArm;
Servo rArm;
Servo lLeg;
Servo rLeg;
int lArmPos = 0;
int lLegPos = 0;
int rArmPos = 0;
//: 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;
#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'
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)
#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;
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))
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:
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)
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))
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)