Skip to content

Instantly share code, notes, and snippets.

View ghtomcat's full-sized avatar

Markus Leutwyler ghtomcat

View GitHub Profile
/**************************************************************************
read bme280 data and display on ssd1306
**************************************************************************/
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_Sensor.h>
/*******************************************************************
A sketch for controlling a robot with using a web page
hosted on a ESP32
based on: https://github.com/witnessmenow/simple-wifi-controlled-rc-car
********************************************************************/
// Load Wi-Fi library
#include <WiFi.h>
#include <WebServer.h>
#include <QTRSensors.h>
// load motor library
#include "ESP32MotorControl.h"
#define KP 0.5
#define KD 0
#define M1_MAX_SPEED 70
#define M2_MAX_SPEED 70
#define M1_DEFAULT_SPEED 50
#include <QTRSensors.h>
// This example is designed for use with six analog QTR sensors. These
// reflectance sensors should be connected to analog pins A0 to A5. The
// sensors' emitter control pin (CTRL or LEDON) can optionally be connected to
// digital pin 2, or you can leave it disconnected and remove the call to
// setEmitterPin().
//
// The setup phase of this example calibrates the sensors for ten seconds and
// turns on the Arduino's LED (usually on pin 13) while calibration is going
/*******************************************************************
A sketch for controlling a robot with using a web page
hosted on a ESP32
based on: https://github.com/witnessmenow/simple-wifi-controlled-rc-car
********************************************************************/
// Load Wi-Fi library
#include <WiFi.h>
#include <WebServer.h>
/*******************************************************************
A sketch for controlling a robot with using a web page
hosted on a ESP32
based on: https://github.com/witnessmenow/simple-wifi-controlled-rc-car
********************************************************************/
// Load Wi-Fi library
#include <WiFi.h>
#include <WebServer.h>
/**************************************************************************
read bme280 data and display on ssd1306
**************************************************************************/
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_Sensor.h>
R"(
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
// META PARAMETERS USED FOR TRAINING
// Generation: 143 of 200
// No of experiments per generation: 300
// Spot light displacement: 3.5
// Angular velocity punishment: 10000
// Runtime (episode duration in seconds): 4
// Initial weight max: 4
// Final weight max: 0.25
// Motor force multiplier: 10
// Number of Hidden nodes: 10
var keypress = require('keypress');
var five = require("johnny-five");
var EtherPortClient = require("etherport-client").EtherPortClient;
var board = new five.Board({
port: new EtherPortClient({
host: "xx.xx.xx.xx",
port: 3030
}),