Skip to content

Instantly share code, notes, and snippets.

View Happsson's full-sized avatar

Hannes Paulsson Happsson

View GitHub Profile
package math;
import java.util.ArrayList;
/**
* Hittar primtal.
* Kollar bara ojämna tal, jämför genom att kolla om talet som ska undersökas är delbart med tidigare hittade primtal.
* Om ja är det inte ett primtal. Om nej måste det vara det.
* Kollar också om talets komponenter summeras till 3, om så kan det inte vara ett primtal.
* Kollar bara tal som inte slutar på 5.
public class Labb1 {
public static int length = 1;
public static int n;
public static void main(String args[]) {
count(2);
String _n = "101";
n = _n.length();
const int trigPin = 4;
const int echoPin = 2;
void setup(){
Serial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop()
#include "LedControlMS.h"
#include <math.h>
#include <stdlib.h>
#include <stdbool.h>
#define NBR_MTX 2
LedControl lc=LedControl(12,11,10, NBR_MTX);
int speed = 100;
#include "LedControlMS.h"
#include <math.h>
#include <stdlib.h>
#include <stdbool.h>
#define NBR_MTX 2
LedControl lc=LedControl(12,11,10, NBR_MTX);
/*
* snake.ino
*
* A simple snake game.
* When a player hits the wall or the tail of the snake, the score flashes on the screen.
*
* This code is written for use with a 8x8 led matrix, controlled by a MAX7219
*
* Remember to download and include LedControlMS from
@Happsson
Happsson / gist:6826d761a7a7744b5ac9
Created December 8, 2015 07:33
Kalman filter quadcopter
/**
* STM32F303
* RX-> PD8
* TX-> PD9
* Baud 9600 (standard)
* 0.1
*/
@Happsson
Happsson / analyze.java
Created December 10, 2015 08:10
Analyzer processing
/**
* STM32F303
* RX-> PD8
* TX-> PD9
* Baud 9600 (standard)
* 0.1
*/
@Happsson
Happsson / pwm.c
Created December 11, 2015 08:02
pwm-in
/*
Interrupt handle and task for PWM-in.
@Author: Hannes Paulsson, Ramon Rodriguez
Channels on controller:
1 : Roll
2 : Thrust
3 : Pitch
4 : Yaw
@Happsson
Happsson / pwmin.c
Created December 11, 2015 11:24
pwn in redo
/*
Interrupt handle and task for PWM-in.
@Author: Hannes Paulsson, Ramon Rodriguez
Channels on controller:
1 : Roll
2 : Thrust
3 : Pitch
4 : Yaw