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;
import random
a = []
even_list = []
while len(a) < 30:
x = random.randint(0, 999)
a.append(x)
for x in a:
even = x % 2
word = input(str("Enter a word: "))
match = [x for x in word]
while " " in match:
match.remove(" ")
if (match == (match[::-1])):
print("Your string is a palindrome!")
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)
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))
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)