Stub for Demos
authorMjolnir <thomas.pietrzak@inria.fr>
Wed, 2 Sep 2015 15:48:39 +0000 (17:48 +0200)
committerMjolnir <thomas.pietrzak@inria.fr>
Wed, 2 Sep 2015 15:48:39 +0000 (17:48 +0200)
ArduinoScreen/ArduinoScreen.ino
ArduinoScreen/motorcontrol.ino
LivingDemos/LivingDemos.pro [new file with mode: 0644]
LivingDemos/MenuPrincipal.cpp [new file with mode: 0644]
LivingDemos/MenuPrincipal.h [new file with mode: 0644]
LivingDemos/main.cpp [new file with mode: 0644]
LivingDemos/menuprincipal.ui [new file with mode: 0644]
Test/Test.pro

index e85c873c263972e5b47eb3f447c52fbf751489b2..8f48b022312ee4bbb450519539bdb84a10cf7189 100644 (file)
@@ -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();
index 674687c76d982430daf0de57fe5d58d5667feb20..b108a54082982c529308d64097df9e6497833b57 100644 (file)
@@ -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 (file)
index 0000000..4c79fdc
--- /dev/null
@@ -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 (file)
index 0000000..226b888
--- /dev/null
@@ -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 (file)
index 0000000..9394fa3
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef MENUPRINCIPAL_H
+#define MENUPRINCIPAL_H
+
+#include <QMainWindow>
+
+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 (file)
index 0000000..7418054
--- /dev/null
@@ -0,0 +1,11 @@
+#include "MenuPrincipal.h"
+#include <QApplication>
+
+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 (file)
index 0000000..aec54c4
--- /dev/null
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MenuPrincipal</class>
+ <widget class="QMainWindow" name="MenuPrincipal">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>894</width>
+    <height>618</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MenuPrincipal</string>
+  </property>
+  <widget class="QWidget" name="centralWidget">
+   <layout class="QVBoxLayout" name="verticalLayout">
+    <item>
+     <widget class="QLabel" name="label">
+      <property name="maximumSize">
+       <size>
+        <width>16777215</width>
+        <height>200</height>
+       </size>
+      </property>
+      <property name="font">
+       <font>
+        <pointsize>50</pointsize>
+       </font>
+      </property>
+      <property name="text">
+       <string>Living Demos</string>
+      </property>
+      <property name="alignment">
+       <set>Qt::AlignCenter</set>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <layout class="QGridLayout" name="gridLayout">
+      <item row="1" column="1">
+       <widget class="QPushButton" name="pushButton_4">
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>150</height>
+         </size>
+        </property>
+        <property name="font">
+         <font>
+          <pointsize>30</pointsize>
+         </font>
+        </property>
+        <property name="text">
+         <string>PushButton</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QPushButton" name="pushButton_3">
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>150</height>
+         </size>
+        </property>
+        <property name="font">
+         <font>
+          <pointsize>30</pointsize>
+         </font>
+        </property>
+        <property name="text">
+         <string>PushButton</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <widget class="QPushButton" name="pushButton_2">
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>150</height>
+         </size>
+        </property>
+        <property name="font">
+         <font>
+          <pointsize>30</pointsize>
+         </font>
+        </property>
+        <property name="text">
+         <string>PushButton</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="0">
+       <widget class="QPushButton" name="pushButton">
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>150</height>
+         </size>
+        </property>
+        <property name="font">
+         <font>
+          <pointsize>30</pointsize>
+         </font>
+        </property>
+        <property name="text">
+         <string>PushButton</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+</ui>
index 4435f9c0b39503dc74c42a3914982b2358db757b..60e877eb2a808cddd99d7da38838231e5c2832fa 100644 (file)
@@ -4,7 +4,7 @@
 #
 #-------------------------------------------------
 
-QT       += core gui serialport
+QT       += core gui
 
 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets