This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set the date and the time | |
#include <RTClib.h> | |
RTC_DS1307 rtc; | |
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; | |
void setup () { | |
Serial.begin(9600); | |
if (! rtc.begin()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example program | |
#include <iostream> | |
#include <string> | |
//class SimTimeout { | |
//public: | |
// SimTimeout(bool (*function)(void), int r) : mockedFunction(function), expectedReturn(r){} | |
// bool timesOutAfter(unsigned long m); | |
//private: | |
// bool (*mockedFunction)(void) = nullptr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Smartcar.h> | |
const int buzzerPin = 13; //το pin στο οποίο είναι συνδεδεμένος ο βομβητής (buzzer) | |
const int ledOnePin = 12; //το pin στο οποίο είναι συνδεδεμένο το λαμπάκι για το πρώτο καπάκι | |
const int ledTwoPin = 11; //το pin στο οποίο είναι συνδεδεμένο το λαμπάκι για το δεύτερο καπάκι | |
const unsigned long INTERVAL = 5000; //Ο χρόνος που μεσολαβεί μεταξύ τη λήψη δύο δοσολογιών των φαρμάκων | |
unsigned long previousTime = 0; //Η χρονική στιγμή όπου έγινε η λήψη του προηγούμενου φαρμάκου | |
boolean buzzerRinging = false; //μεταβλητή που αντιπροσωπεύει εάν ο βομβητής χτυπάει ή όχι |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Smartcar.h> | |
SR04 sensor1, sensor2; | |
const int TRIGGER_1 = 6; // Χρησιμοποιήστε τα pin που θέλετε | |
const int ECHO_1 = 7; | |
const int TRIGGER_2 = A2; | |
const int ECHO_2 = A3; | |
int sum1 = 0; | |
int sum2 = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Declare random variables | |
int ledPin = 3; | |
int state = 0; | |
int flag = 0; | |
int delayPeriod = 500; | |
//on set up, arduino LED is off and ledPin is set to output | |
void setup() { | |
pinMode(ledPin, OUTPUT); | |
digitalWrite(ledPin, LOW); | |
Serial.begin(9600); // declare connection baudrate rate of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Smartcar.h> | |
#include <SoftwareSerial.h> | |
/* Χρησιμοποιήστε τα σωστά pins!!!! */ | |
const int SONAR_LEFT_TRIGGER = 4; //trigger του αριστερού υπέρηχου | |
const int SONAR_LEFT_ECHO = 5; //echo του αριστερού υπέρηχου | |
const int SONAR_RIGHT_TRIGGER = A0; //trigger του δεξιού υπέρηχου | |
const int SONAR_RIGHT_ECHO = A1; //echo του δεξιού υπέρηχου | |
const int SONAR_FRONT_TRIGGER = A2; //trigger του μπροστινού υπέρηχου | |
const int SONAR_FRONT_ECHO = A3; //echo του μπροστινού υπέρηχου |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <UTFT.h> | |
// Declare which fonts we will be using | |
extern uint8_t BigFont[]; //SmallFont[] | |
// Uncomment the next line for Arduino Mega | |
UTFT lcd(ITDB32WC, 38, 39, 40, 41); // Remember to change the model parameter to suit your display module! | |
const unsigned long initialSpeed = 40; //the initial speed of the ball (in milliseconds) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setMotorSpeed(base - angle, base + angle) | |
float pid(float previousAngle, float currentError){ | |
float correction = 0; | |
integratedError += currentError; | |
correction = P * currentError + I * integratedError + D (currentError - previousError); | |
previousError = currentError; | |
return previousAngle + correction; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Smartcar.h> | |
#include <SoftwareSerial.h> | |
Odometer encoderLeft(190), encoderRight(190); //Βάλτε τους δικούς σας παλμούς ανά μέτρο | |
Gyroscope gyro(13); //Βάλτε την κατάλληλη τιμή σύμφωνα με το γυροσκόπιό σας | |
Car folkracer; | |
SR04 sonarLeft, sonarRight, sonarFront; //dilwse tis metavlites sonarLeft, sonarRight kai sonarFront pou antiproswpevoun tous iperixous | |
SoftwareSerial bluetooth(6,7); //συνδέστε το bluetooth ως εξής: Το RX του Bluetooth στο pin 6 και το ΤΧ του bluetooth στο pin 7 (VCC -> 5V, GND -> GND) | |
/* Χρησιμοποιήστε τα σωστά pins!!!! */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The running arduino sketch on the Android Autonomous Vehicle by Team Pegasus | |
* Original file: https://github.com/platisd/AndroidCar/blob/master/examples/androidCar/androidCar.ino | |
* Description: The vehicle is based on an Arduino Mega, that is connected to various sensors | |
* (infrared, ultrasound, speed encoder, gyroscope and 9DOF IMU) and receives driving instructions | |
* from an Android phone, via Bluetooth, that is attached on the top of the vehicle. The vehicle | |
* can follow street lanes, park and overtake obstacles, using image processing on the Android phone. | |
* | |
* Author: Dimitris Platis | |
*/ | |
#include <Smartcar.h> |