Skip to content

Instantly share code, notes, and snippets.

import RPi.GPIO as GPIO
import time
# Motor pins (change these according to your connections)
pin_A = 17
pin_B = 27
pin_A_not = 22
pin_B_not = 23
# Setup GPIO pins
@leoforney
leoforney / App.js
Created February 21, 2022 05:01
Simple ToDo list in React Native
import {StatusBar} from 'expo-status-bar';
import {Button, FlatList, StyleSheet, Text, View, TextInput, SafeAreaView} from 'react-native';
import React, {Component} from 'react';
class ListComponent extends React.Component {
constructor(props) {
super(props);
}
render() {
import balloon3.Balloon;
import org.junit.Test;
import static org.junit.Assert.*;
/*
B1 - Max blow failed, initial isn't 0, blows while popped
B2 - Blows while balloon is popped
B3 - Correct version
/**
* Raspberry Pi Doors
*
* Copyright 2016 Leo Foney
*
*/
definition(
name: "Raspberry Pi Doors",
namespace: "leoforney",
author: "Leo Forney",
@leoforney
leoforney / log
Created January 3, 2017 14:31
Android build error log on Windows
including ./tools/tradefederation/Android.mk ...
build/core/tasks/tools/package-modules.mk:20: Unknown installed file for module 'perf-setup.sh'
build/core/tasks/tools/package-modules.mk:20: Unknown installed file for module 'FrameworksUtilsTests'
build/core/tasks/tools/package-modules.mk:20: Unknown installed file for module 'RecyclerViewTests'
build/core/tasks/tools/package-modules.mk:20: Unknown installed file for module 'SettingsFunctionalTests'
build/core/tasks/tools/package-modules.mk:20: Unknown installed file for module 'LauncherFunctionalTests'
build/core/tasks/tools/package-modules.mk:20: Unknown installed file for module 'perf-setup.sh'
build/core/base_rules.mk:364: warning: overriding commands for target `out/target/product/generic_x86/data/nativetest/linux-kselftest/cpu-hotplug/cpu-on-off-test.sh'
build/core/base_rules.mk:364: warning: ignoring old commands for target `out/target/product/generic_x86/data/nativetest/linux-kselftest/cpu-hotplug/cpu-on-off-test.sh'
build/core/base_rules.mk:364: warn
@leoforney
leoforney / error.logcat
Created December 14, 2016 02:25
FTC Robot Controller error log
Battery Power Supply logging Daemon start!!!!!
12-13 20:21:37.640 14992-14992/? E/NEW_BHD: Cannot run on production devices!
12-13 20:21:40.780 13500-14955/? W/RobotCore: [55 aa 80 40 1e] -> [33 cc 80 40 1e]
12-13 20:21:40.780 13500-14955/? W/RobotCore: could not read Modern Robotics USB DC Motor Controller [AL00VXNM]: comm timeout on payload
12-13 20:21:40.816 263-817/? I/SFPerfTracer: triggers: (rate: 0:3) (454 sw vsyncs) (0 skipped) (0:12423 vsyncs) (1:25186)
12-13 20:21:42.667 14993-14993/? E/NEW_BHD: Battery Power Supply logging Daemon start!!!!!
12-13 20:21:42.668 14993-14993/? E/NEW_BHD: Cannot run on production devices!
12-13 20:21:44.762 2272-3475/? D/WifiStateMachine: ===> 140.86,431.61 - 138.71,380.22 - 38874,25766
12-13 20:21:46.034 13500-14957/? E/RobotCore: OpMode 'TeleOpSuperSimple' stuck in loop(). Restarting robot controller app.
12-13 20:21:46.035 13500-14957/? E/RobotCore: Begin thread dump
@leoforney
leoforney / VCNL4010.java
Created August 30, 2016 03:39
FTC Sensor help
package com.qualcomm.ftcrobotcontroller.library.devices;
import com.qualcomm.ftcrobotcontroller.library.Wire;
import com.qualcomm.robotcore.hardware.HardwareMap;
/**
* Created by Leo on 2/15/2016.
*/
public class VCNL4010 {
Wire pr;
private int spoofedZero(int zeroDegree) {
int ActualDegree = gyro.getHeading();
int degree = ActualDegree - zeroDegree;
if (degree > 360) {
degree = degree - 360;
}
if (degree < 0) {
degree = degree + 360;
}
return degree;
/* Copyright (c) 2014 Qualcomm Technologies Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted (subject to the limitations in the disclaimer below) provided that
the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
// This is the power that only has a max of 75%...
int multPower = 0.75;
// your loop statement here...
public void loop() {
// Get numeric value from gamepad1 on the left trigger, can be changeable...
float leftTriggerPressed = gamepad1.left_trigger;
if (leftTriggerPressed != 0) {
// If the left trigger is slightly to all the way pressed, set the power to a max of 45%
multPower = 0.45;