Skip to content

Instantly share code, notes, and snippets.

View Swapnull's full-sized avatar
🙃

Martyn Rushton Swapnull

🙃
View GitHub Profile
@Swapnull
Swapnull / Skills.md
Last active December 5, 2022 11:00
A good starting point...
@Swapnull
Swapnull / CodeOutput.jsx
Last active November 28, 2020 18:57
Code Ouput for docz
// @flow
import React from 'react';
import SyntaxHighlighter from 'react-syntax-highlighter/prism';
import { dark } from 'react-syntax-highlighter/styles/prism';
import { renderToStaticMarkup } from 'react-dom/server';
import pretty from 'pretty';
import jsxToString from 'jsx-to-string';
type Props = { children: any, showReact?: boolean, showHTML?: boolean, showIcon?: boolean };
type State = { active: number };
// this is the new behaviour. You set a global varaible inside the lineFollower task and then use it inside an arbiter.
// forage variables are show to give an idea of how it works.
int forage_left, forage_right, follow_left, follow_right;
task arbiter(){
if( follow_left || follow_right) {
setMotorSpeed(left, follow_left);
setMotorSpeed(right, follow_right);
} else if (forage_left || forage_right) {
@Swapnull
Swapnull / ARS-arbiter.c
Last active October 18, 2016 08:25
ARS Tutorial2
/* We use the most important first in the if statement. If follow_left and follow_right are not 0, then we use the follow
otherwise we check the next one, which is forage */
task arbiter() {
if ( follow_left || follow_right) {
move(follow_left, follow_right);
} else if ( forage_left || forage_right) {
move(forage_left, forage_right);
}
}
class kinect():
def __init__(self):
#initialize the class
def searchForRed(self):
#search for color with RGB values passed in
if found :
return true
else:
return false
class kinect():
def __init__(self):
#initialize the class
self.foundColor = NULL
def getColor(self):
if self.searchForColor(255, 0, 0): #look for red
self.foundColor = 'red'
elif self.searchForColor(0, 255, 0): #look for green
const int A
void setConstant(int x){
A = x;
}