Skip to content

Commit

Permalink
ui 구현 완료 switch 펌웨어 동작안해서 수정중
Browse files Browse the repository at this point in the history
  • Loading branch information
coreanq committed Aug 24, 2016
1 parent b688487 commit 6c22645
Show file tree
Hide file tree
Showing 11 changed files with 224 additions and 147 deletions.
6 changes: 5 additions & 1 deletion arduino/ultra_sonic_firmata/ultra_sonic_firmata.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

#define trigPin 11
#define echoPin 12
#define RedLed 13
#define switchPin 10
#define RedLed 4
#define greenLed 3
#define pingPin 7

Expand All @@ -12,6 +13,7 @@ void setup() {
pinMode(echoPin, INPUT);
pinMode(RedLed, OUTPUT);
pinMode(greenLed, OUTPUT);
pinMode(switchPin, INPUT);
Firmata.setFirmwareVersion(FIRMATA_FIRMWARE_MAJOR_VERSION, FIRMATA_FIRMWARE_MINOR_VERSION);
Firmata.begin(115200);
}
Expand All @@ -27,6 +29,8 @@ void loop()
// Serial.print(distance);
// Serial.println(" cm");
Firmata.sendAnalog(pingPin, distance);
bool pinState = digitalRead(switchPin);
Firmata.sendDigitalPort(switchPin, pinState);
}


Expand Down
Binary file added image/background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/card_back.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/card_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/switch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 5 additions & 30 deletions qml/InitWnd.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,23 @@ import QtQml.StateMachine 1.0 as DSM
import "firmata"

Rectangle{
signal dataReceived(int rawValue)
signal comPortOpened()
signal comPortClosed()
signal sizeChanged()

id: initWnd
color: "lightblue"
clip: true


PortSelector {
id: port
anchors.top: parent.top
width: parent.width
height: 40
clip: true
onDataReceived: {
dataReceived(rawValue)
}
onPortOpened: {
comPortOpened()

}
onPortClosed: {
comPortClosed()
}

}
Item {
id: container
anchors.top : port.bottom
anchors.top : parent.top
clip: true

anchors.verticalCenterOffset: port.height
anchors.verticalCenterOffset: parent.height
width: parent.width
height: parent.height - port.height - label.height
height: parent.height - label.height
Rectangle{
anchors.fill: parent
color: "black"
opacity: 0.8
opacity: 0.5
}
Rectangle {
id: focus
Expand Down Expand Up @@ -133,7 +111,6 @@ Rectangle{
focus.x = transPoint.x - 15
focus.y = transPoint.y - 15
label.text = "컴퓨터를 준비"
console.log(transPoint)
}
onExited: {
}
Expand All @@ -155,7 +132,6 @@ Rectangle{
focus.x = transPoint.x - 15
focus.y = transPoint.y - 15
label.text = "장비와 컴퓨터를 연결"
console.log(transPoint)
}
onExited: {
}
Expand All @@ -178,7 +154,6 @@ Rectangle{
focus.x = transPoint.x - 10
focus.y = transPoint.y - 10
label.text = "Open 을 클릭하여 장비를 활성"
console.log(transPoint)
}
onExited: {
}
Expand Down
27 changes: 15 additions & 12 deletions qml/ProcessingWnd.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@ import QtQuick.Layouts 1.3
import "firmata"

Rectangle{
id: main
id: processingWnd
color: "black"

Connections {
target: mainWnd
onComDataReceived:{
// console.log("%")
dataUpdate(rawValue)
}
onComSwitchChanged:{
console.log(state)
}
}

QChartGallery{
id: gallery
anchors.left: main.left
anchors.top: port.bottom
width: main.width
height: main.height

Rectangle{
visible: false
anchors.fill: parent
color: "green"
opacity: 0.5
}
anchors.fill: parent
anchors.margins: 5
}
Timer {
id: timer
Expand Down
2 changes: 1 addition & 1 deletion qml/QChartGallery.qml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Item {
anchors.top: parent.top
anchors.left: parent.left
width: parent.width;
height: parent.height - button.height;
height: parent.height ;

columns: 1;
spacing: chart_spacing;
Expand Down
23 changes: 11 additions & 12 deletions qml/StandbyWnd.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ import QtQml.StateMachine 1.0 as DSM

Rectangle{
id: standbyWnd
color: "yellow"
opacity: 0.5
color: "lightyellow"
clip: true
Rectangle {
anchors.fill: parent
anchors.margins: 5
color: "black"
z: -1
}

Item {
id: container
width: parent.width
Expand All @@ -20,18 +26,11 @@ Rectangle{
anchors.verticalCenter: parent.verticalCenter
source:"../image/switch.png"
scale: 1.5
Behavior on y {
NumberAnimation {
duration: 1000
loops: Animation.Infinite
easing.type: Easing.InOutQuad
}
}
}
Image {
id: click
x: parent.x
y: parent.height - click.paintedHeight * 1.5
y: parent.height - click.sourceSize.height * 1.5
source: "../image/click.png"
scale: 1.5
Behavior on y {
Expand Down Expand Up @@ -64,7 +63,7 @@ Rectangle{
id: initState
DSM.TimeoutTransition{
targetState: clickedState
timeout: 2000
timeout: 1000
}
onEntered: {
switchOn.visible = true
Expand All @@ -78,7 +77,7 @@ Rectangle{
id: clickedState
DSM.TimeoutTransition{
targetState: initState
timeout: 2000
timeout: 1500
}
onEntered: {
click.x = switchOn.x + 15
Expand Down
12 changes: 12 additions & 0 deletions qml/firmata/PortSelector.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Firmata 1.0

RowLayout {
signal dataReceived(int rawValue)
signal swithChanged(bool state)
signal portOpened()
signal portClosed()

Expand All @@ -31,8 +32,18 @@ RowLayout {
pin:7
onSampled: {
dataReceived(rawValue)
// console.log(rawValue)
}
}
DigitalPin{
output: false
pin: 10
onValueChanged: {
console.log(v)
// switchChanged(value)
}

}
}

ComboBox {
Expand All @@ -43,6 +54,7 @@ RowLayout {

Button{
id: btnOpen
width: 100
text: "Open"
onClicked: {
if( text == "Open" ){
Expand Down
Loading

0 comments on commit 6c22645

Please sign in to comment.