From: Mjolnir Date: Wed, 2 Sep 2015 15:48:39 +0000 (+0200) Subject: Stub for Demos X-Git-Url: https://git.thomaspietrzak.com/?a=commitdiff_plain;h=a554c008946d385fbbfe18e2fb3c268cf8509c95;p=livingdesktop.git Stub for Demos --- diff --git a/ArduinoScreen/ArduinoScreen.ino b/ArduinoScreen/ArduinoScreen.ino index e85c873..8f48b02 100644 --- a/ArduinoScreen/ArduinoScreen.ino +++ b/ArduinoScreen/ArduinoScreen.ino @@ -17,7 +17,7 @@ int value = 0; #define POSITIVE 0 #define NEGATIVE 1 int sign = POSITIVE; - +int a; void eval(int command, int value) { @@ -37,6 +37,11 @@ void eval(int command, int value) Serial.println(value); rotate(value); break; + case 'A': + a = angle(); + Serial.print("Angular position: "); + Serial.println(a); + break; case 'C': Serial.println("Calibration"); calibrate(); diff --git a/ArduinoScreen/motorcontrol.ino b/ArduinoScreen/motorcontrol.ino index 674687c..b108a54 100644 --- a/ArduinoScreen/motorcontrol.ino +++ b/ArduinoScreen/motorcontrol.ino @@ -24,6 +24,8 @@ void init_motors() void calibrate() { + rotate(95); + digitalWrite(motorsenable, HIGH); //move to left digitalWrite(motorpin1, LOW); @@ -118,6 +120,14 @@ void translate(int distance) digitalWrite(motorsenable, LOW); } +/* + get current angle position +*/ +int angle() +{ + return servo.read(); +} + /* angle +: clockwise @@ -125,5 +135,6 @@ void translate(int distance) */ void rotate(int angle) { + servo.write(angle); } diff --git a/LivingDemos/LivingDemos.pro b/LivingDemos/LivingDemos.pro new file mode 100644 index 0000000..4c79fdc --- /dev/null +++ b/LivingDemos/LivingDemos.pro @@ -0,0 +1,30 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2015-09-02T17:40:46 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = LivingDemos +TEMPLATE = app +DEPENDPATH += $$PWD/../Library +INCLUDEPATH += $$PWD/../Library + +CONFIG(debug, debug|release) { +LIBS += -L$$PWD/../builds/livingdesktop-Debug -lLivingDesktop +} + +CONFIG(release, debug|release) { +LIBS += -L$$PWD/../builds/livingdesktop-Release -lLivingDesktop +} + + +SOURCES += main.cpp\ + MenuPrincipal.cpp + +HEADERS += MenuPrincipal.h + +FORMS += menuprincipal.ui diff --git a/LivingDemos/MenuPrincipal.cpp b/LivingDemos/MenuPrincipal.cpp new file mode 100644 index 0000000..226b888 --- /dev/null +++ b/LivingDemos/MenuPrincipal.cpp @@ -0,0 +1,14 @@ +#include "MenuPrincipal.h" +#include "ui_menuprincipal.h" + +MenuPrincipal::MenuPrincipal(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MenuPrincipal) +{ + ui->setupUi(this); +} + +MenuPrincipal::~MenuPrincipal() +{ + delete ui; +} diff --git a/LivingDemos/MenuPrincipal.h b/LivingDemos/MenuPrincipal.h new file mode 100644 index 0000000..9394fa3 --- /dev/null +++ b/LivingDemos/MenuPrincipal.h @@ -0,0 +1,22 @@ +#ifndef MENUPRINCIPAL_H +#define MENUPRINCIPAL_H + +#include + +namespace Ui { + class MenuPrincipal; +} + +class MenuPrincipal : public QMainWindow +{ + Q_OBJECT + + public: + explicit MenuPrincipal(QWidget *parent = 0); + ~MenuPrincipal(); + + private: + Ui::MenuPrincipal *ui; +}; + +#endif // MENUPRINCIPAL_H diff --git a/LivingDemos/main.cpp b/LivingDemos/main.cpp new file mode 100644 index 0000000..7418054 --- /dev/null +++ b/LivingDemos/main.cpp @@ -0,0 +1,11 @@ +#include "MenuPrincipal.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MenuPrincipal w; + w.show(); + + return a.exec(); +} diff --git a/LivingDemos/menuprincipal.ui b/LivingDemos/menuprincipal.ui new file mode 100644 index 0000000..aec54c4 --- /dev/null +++ b/LivingDemos/menuprincipal.ui @@ -0,0 +1,121 @@ + + + MenuPrincipal + + + + 0 + 0 + 894 + 618 + + + + MenuPrincipal + + + + + + + + 16777215 + 200 + + + + + 50 + + + + Living Demos + + + Qt::AlignCenter + + + + + + + + + + 0 + 150 + + + + + 30 + + + + PushButton + + + + + + + + 0 + 150 + + + + + 30 + + + + PushButton + + + + + + + + 0 + 150 + + + + + 30 + + + + PushButton + + + + + + + + 0 + 150 + + + + + 30 + + + + PushButton + + + + + + + + + + + + diff --git a/Test/Test.pro b/Test/Test.pro index 4435f9c..60e877e 100644 --- a/Test/Test.pro +++ b/Test/Test.pro @@ -4,7 +4,7 @@ # #------------------------------------------------- -QT += core gui serialport +QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets