Skip to content

Commit 88c461f

Browse files
committed
Add pgadmin and map sensor from 0 to 100
1 parent 14c4599 commit 88c461f

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

GoPlantESP/GoPlantESP.ino

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#include <ESP8266WiFi.h>
22
#include <WiFiUdp.h>
33

4-
#define WIFI_SSID "****"
5-
#define WIFI_PASS "****"
4+
#define WIFI_SSID "*"
5+
#define WIFI_PASS "*"
66
#define UDP_PORT 8080
77
#define SENSOR_ID "1"
88

99
WiFiUDP UDP;
1010
char packet[255];
1111
char reply[] = "";
12-
const char *remoteip = "*****";
12+
const char *remoteip = "*";
1313
IPAddress remote;
1414

1515
int sensorValue;
@@ -81,7 +81,8 @@ void loop() {
8181
int logSoilMoistureSensor(){
8282
digitalWrite(powerPin, HIGH);
8383
delay(100);
84-
digitalWrite(powerPin, LOW);
8584
sensorValue = analogRead(sensorPin);
85+
digitalWrite(powerPin, LOW);
86+
sensorValue = map(sensorValue,420,50,0,100);
8687
return sensorValue;
8788
}

docker-compose.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ services:
1212
- POSTGRES_PASSWORD=secret
1313
volumes:
1414
- db-data:/var/lib/postgresql/data:delegated
15+
16+
pgadmin:
17+
container_name: pgadmin4_container
18+
image: dpage/pgadmin4
19+
restart: always
20+
environment:
21+
PGADMIN_DEFAULT_EMAIL: [email protected]
22+
PGADMIN_DEFAULT_PASSWORD: root
23+
ports:
24+
- "5050:80"
1525

1626
volumes:
1727
db-data:

goplantfront/goplantapp/src/sensorPickerCardList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function SensorPickerCardList(props) {
1212
{sensors.map((sensor) => {
1313
return(
1414
<Col md={3}>
15-
<Card key={sensor.ID} className="sensorCard" style={{ width: '18rem' }}>
15+
<Card key={sensor.ID} className="sensorCard mb-4" >
1616
<Card.Body>
1717
<Card.Title>{sensor.Name}</Card.Title>
1818
<Card.Subtitle className="mb-2 text-muted">{sensor.IP}</Card.Subtitle>

pkg/config/app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var (
1313
)
1414

1515
func Connect() {
16-
dsn := "host=172.18.0.2 user=postgres password=postgres dbname=goplantdb port=5432 sslmode=disable"
16+
dsn := "host=localhost user=postgres password=postgres dbname=goplantdb port=5432 sslmode=disable"
1717
d, err := gorm.Open(postgres.Open(dsn), &gorm.Config{})
1818
if err != nil {
1919
fmt.Println("- [Database error]")

0 commit comments

Comments
 (0)