I need some coding help

The_Ogre

Honorary Master
Joined
Apr 30, 2010
Messages
27,843
Reaction score
10,968
Location
Cape Town
@kolaval - you're the most prolific coder on here. So give the other okes a chance. A personal challenge

I bought a building with 31 floors and have guys installing 7 elevators.


Four floors are sub zero, and for this cause, two elevators have the abality to descend sub surface.


This is the setup:

. 7 MSP32 Microcontrollers in each lift, 6 on each floor controlling the coordination

. 4 floors underground

. Since the Microcontrollers have its Bluetooth permanently active, it's constantly listening.

All employees are required to have their phones and, by extention, Bluetooth active,

.The_Mowgs is a bit of a problem so he prefers to use the Bluetooth OPP to do things for him.


Here's what we need.

.as anybody exits their office, any floor, the controllers hahave. to determine on which floor the incumband's office is and summons an elevator to same. Check in, lunch and "chaila" is the same. The same for visiting different floors for meetings during the day.

.MS Teams is integrated using MS API's

.Metings are thus activated once the user moves from his home floor and an immediate request to exit the virtual lobby is initiated

.the two elevators that are allowed to move underground have exclusive access and only they are allowed below ground level.

.unless an employee chooses otherwise, their phone will always request the control to move to their home floor.


I need the embedded code written,, the 4gl code (cpp, c# or go) and obviously the android and iOs code. - the last of which can be in any language (flutter as a tool preferred)
 
@kolaval - you're the most prolific coder on here. So give the other okes a chance. A personal challenge

I bought a building with 31 floors and have guys installing 7 elevators.


Four floors are sub zero, and for this cause, two elevators have the abality to descend sub surface.


This is the setup:

. 7 MSP32 Microcontrollers in each lift, 6 on each floor controlling the coordination

. 4 floors underground

. Since the Microcontrollers have its Bluetooth permanently active, it's constantly listening.

All employees are required to have their phones and, by extention, Bluetooth active,

.The_Mowgs is a bit of a problem so he prefers to use the Bluetooth OPP to do things for him.


Here's what we need.

.as anybody exits their office, any floor, the controllers hahave. to determine on which floor the incumband's office is and summons an elevator to same. Check in, lunch and "chaila" is the same. The same for visiting different floors for meetings during the day.

.MS Teams is integrated using MS API's

.Metings are thus activated once the user moves from his home floor and an immediate request to exit the virtual lobby is initiated

.the two elevators that are allowed to move underground have exclusive access and only they are allowed below ground level.

.unless an employee chooses otherwise, their phone will always request the control to move to their home floor.


I need the embedded code written,, the 4gl code (cpp, c# or go) and obviously the android and iOs code. - the last of which can be in any language (flutter as a tool preferred)
Copy and paste this to ChatGPT.
 
from chatGPT:

1. Embedded Code for MSP32

Write code to control the coordination between the microcontrollers and handle elevator operation

// Sample code for elevator control using MSP32 microcontrollers
// This is a simplified example, please adapt it to your specific needs

// Define pins and variables
const int floorPin = 2;
const int elevatorPin = 3;
int currentFloor = 0;

void setup() {
// Initialize pins and serial communication
pinMode(floorPin, INPUT);
pinMode(elevatorPin, OUTPUT);
Serial.begin(9600);
}

void loop() {
// Read the floor input
int floor = digitalRead(floorPin);

// Check if someone is requesting an elevator
if (floor == HIGH) {
// Determine the floor and move the elevator
int requestedFloor = determineRequestedFloor();
moveElevator(requestedFloor);
}
}

int determineRequestedFloor() {
// Code to determine the requested floor based on inputs
// You can use sensors or other mechanisms to detect the floor
// Return the requested floor number
}

void moveElevator(int floor) {
// Code to move the elevator to the requested floor
// You can control motors, doors, and other elevator components here
// Update the current floor variable
currentFloor = floor;
Serial.println("Elevator moved to floor: " + String(currentFloor));
}


2. 4GL Code:

  • Task: Clarify the specific functionality you need the 4GL code for (e.g., database operations, data processing, etc.). Once you provide more details, I can assist you with the code.
3. Android and iOS Code:

  • Task: Develop separate applications for Android and iOS platforms using Flutter.
  • Code Example (Flutter - Dart):


// Sample code for Flutter app to interact with the elevator system

import 'package:flutter/material.dart';
import 'package:flutter_bluetooth_serial/flutter_bluetooth_serial.dart';

class ElevatorApp extends StatefulWidget {
@override
_ElevatorAppState createState() => _ElevatorAppState();
}

class _ElevatorAppState extends State<ElevatorApp> {
BluetoothConnection _connection;
bool _isConnected = false;

@override
void initState() {
super.initState();
// Connect to the Bluetooth device
connectToDevice();
}

void connectToDevice() async {
BluetoothDevice device;
// Code to discover and connect to the elevator's Bluetooth device
// You can use Flutter Bluetooth libraries for this
// Once connected, update the _connection and _isConnected variables
}

void requestElevator(int floor) {
// Code to send the elevator request to the embedded microcontrollers
// You can use the _connection to send Bluetooth commands
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Elevator App'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Select your floor:',
style: TextStyle(fontSize: 20),
),
ElevatedButton(
onPressed: () {
requestElevator(1); // Replace with the selected floor
},
child: Text('Floor 1'),
),
ElevatedButton(
onPressed: () {
requestElevator(2); // Replace with the selected floor
},
child: Text('Floor 2'),
),
// Add more buttons for other floors
],
),
),
);
}
}

void main() {
runApp(ElevatorApp());
}

Please note that the provided code snippets are simplified examples to give you a starting point. You'll need to adapt and expand them based on your specific requirements and the libraries you choose to use.
 
from chatGPT:

1. Embedded Code for MSP32

Write code to control the coordination between the microcontrollers and handle elevator operation

// Sample code for elevator control using MSP32 microcontrollers
// This is a simplified example, please adapt it to your specific needs

// Define pins and variables
const int floorPin = 2;
const int elevatorPin = 3;
int currentFloor = 0;

void setup() {
// Initialize pins and serial communication
pinMode(floorPin, INPUT);
pinMode(elevatorPin, OUTPUT);
Serial.begin(9600);
}

void loop() {
// Read the floor input
int floor = digitalRead(floorPin);

// Check if someone is requesting an elevator
if (floor == HIGH) {
// Determine the floor and move the elevator
int requestedFloor = determineRequestedFloor();
moveElevator(requestedFloor);
}
}

int determineRequestedFloor() {
// Code to determine the requested floor based on inputs
// You can use sensors or other mechanisms to detect the floor
// Return the requested floor number
}

void moveElevator(int floor) {
// Code to move the elevator to the requested floor
// You can control motors, doors, and other elevator components here
// Update the current floor variable
currentFloor = floor;
Serial.println("Elevator moved to floor: " + String(currentFloor));
}


2. 4GL Code:

  • Task: Clarify the specific functionality you need the 4GL code for (e.g., database operations, data processing, etc.). Once you provide more details, I can assist you with the code.
3. Android and iOS Code:

  • Task: Develop separate applications for Android and iOS platforms using Flutter.
  • Code Example (Flutter - Dart):


// Sample code for Flutter app to interact with the elevator system

import 'package:flutter/material.dart';
import 'package:flutter_bluetooth_serial/flutter_bluetooth_serial.dart';

class ElevatorApp extends StatefulWidget {
@override
_ElevatorAppState createState() => _ElevatorAppState();
}

class _ElevatorAppState extends State {
BluetoothConnection _connection;
bool _isConnected = false;

@override
void initState() {
super.initState();
// Connect to the Bluetooth device
connectToDevice();
}

void connectToDevice() async {
BluetoothDevice device;
// Code to discover and connect to the elevator's Bluetooth device
// You can use Flutter Bluetooth libraries for this
// Once connected, update the _connection and _isConnected variables
}

void requestElevator(int floor) {
// Code to send the elevator request to the embedded microcontrollers
// You can use the _connection to send Bluetooth commands
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Elevator App'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Select your floor:',
style: TextStyle(fontSize: 20),
),
ElevatedButton(
onPressed: () {
requestElevator(1); // Replace with the selected floor
},
child: Text('Floor 1'),
),
ElevatedButton(
onPressed: () {
requestElevator(2); // Replace with the selected floor
},
child: Text('Floor 2'),
),
// Add more buttons for other floors
],
),
),
);
}
}

void main() {
runApp(ElevatorApp());
}

Please note that the provided code snippets are simplified examples to give you a starting point. You'll need to adapt and expand them based on your specific requirements and the libraries you choose to use.
Close.. I haven't pinned it down yet myself
 
Here's a further simplified breakdown of the tasks involved in your project and some code snippets with additional details:


  1. Embedded Code for MSP32 Microcontrollers:
    • Task: Write code to control the coordination between the microcontrollers and handle elevator operations.
    • Code Example (C/C++):
    • // Sample code for elevator control using MSP32 microcontrollers

      // Define pins and variables
      const int floorPin = 2;
      const int elevatorPin = 3;
      int currentFloor = 0;

      void setup() {
      // Initialize pins and serial communication
      pinMode(floorPin, INPUT);
      pinMode(elevatorPin, OUTPUT);
      Serial.begin(9600);
      }

      void loop() {
      // Read the floor input
      int floor = digitalRead(floorPin);

      // Check if someone is requesting an elevator
      if (floor == HIGH) {
      // Determine the requested floor and move the elevator
      int requestedFloor = determineRequestedFloor();
      moveElevator(requestedFloor);
      }
      }

      int determineRequestedFloor() {
      // Code to determine the requested floor based on inputs
      // You can use sensors or other mechanisms to detect the floor
      // Return the requested floor number
      }

      void moveElevator(int floor) {
      // Code to move the elevator to the requested floor
      // You can control motors, doors, and other elevator components here
      // Update the current floor variable
      currentFloor = floor;
      Serial.println("Elevator moved to floor: " + String(currentFloor));
      }
    • 4GL Code:
      • Task: Clarify the specific functionality you need the 4GL code for (e.g., database operations, data processing, etc.). Once you provide more details, I can assist you with the code.
    • Android and iOS Code:
      • Task: Develop separate applications for Android and iOS platforms using Flutter.
      • Code Example (Flutter - Dart):
        • // Sample code for Flutter app to interact with the elevator system

          import 'package:flutter/material.dart';
          import 'package:flutter_bluetooth_serial/flutter_bluetooth_serial.dart';

          class ElevatorApp extends StatefulWidget {
          @override
          _ElevatorAppState createState() => _ElevatorAppState();
          }

          class _ElevatorAppState extends State<ElevatorApp> {
          BluetoothConnection _connection;
          bool _isConnected = false;

          @override
          void initState() {
          super.initState();
          // Connect to the Bluetooth device
          connectToDevice();
          }

          void connectToDevice() async {
          BluetoothDevice device;
          // Code to discover and connect to the elevator's Bluetooth device
          // You can use Flutter Bluetooth libraries for this
          // Once connected, update the _connection and _isConnected variables
          }

          void requestElevator(int floor) {
          // Code to send the elevator request to the embedded microcontrollers
          // You can use the _connection to send Bluetooth commands
          }

          @override
          Widget build(BuildContext context) {
          return Scaffold(
          appBar: AppBar(
          title: Text('Elevator App'),
          ),
          body: Center(
          child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
          Text(
          'Select your floor:',
          style: TextStyle(fontSize: 20),
          ),
          ElevatedButton(
          onPressed: () {
          requestElevator(1); // Replace with the selected floor
          },
          child: Text('Floor 1'),
          ),
          ElevatedButton(
          onPressed: () {
          requestElevator(2); // Replace with the selected floor
          },
          child: Text('Floor 2'),
          ),
          // Add more buttons for other floors
          ],
          ),
          ),
          );
          }
          }

          void main() {
          runApp(ElevatorApp());
          }
      • Please note that the provided code snippets are still simplified examples. You'll need to adapt and expand them based on your specific requirements and the libraries you choose to use. Additionally, make sure to handle error cases, implement security measures, and integrate with MS Teams API as per your project needs.​
 
@kolaval - you're the most prolific coder on here. So give the other okes a chance. A personal challenge

I bought a building with 31 floors and have guys installing 7 elevators.


Four floors are sub zero, and for this cause, two elevators have the abality to descend sub surface.


This is the setup:

. 7 MSP32 Microcontrollers in each lift, 6 on each floor controlling the coordination

. 4 floors underground

. Since the Microcontrollers have its Bluetooth permanently active, it's constantly listening.

All employees are required to have their phones and, by extention, Bluetooth active,

.The_Mowgs is a bit of a problem so he prefers to use the Bluetooth OPP to do things for him.


Here's what we need.

.as anybody exits their office, any floor, the controllers hahave. to determine on which floor the incumband's office is and summons an elevator to same. Check in, lunch and "chaila" is the same. The same for visiting different floors for meetings during the day.

.MS Teams is integrated using MS API's

.Metings are thus activated once the user moves from his home floor and an immediate request to exit the virtual lobby is initiated

.the two elevators that are allowed to move underground have exclusive access and only they are allowed below ground level.

.unless an employee chooses otherwise, their phone will always request the control to move to their home floor.


I need the embedded code written,, the 4gl code (cpp, c# or go) and obviously the android and iOs code. - the last of which can be in any language (flutter as a tool preferred)
Question - where are the toilets on each floor? Many buildings have them next to the lifts. Will the lifts trigger when people go to the toilet? Sometimes they have kitchens there too. What if they need to go to another floor and have not made an appointment - will they have to go back to their offices, put it on their calendars then return to the lifts? What about maintenance people who need to get somewhere quickly?

I am just curious.
 
certain times simple things are made over complicated for a reason
 
Question - where are the toilets on each floor? Many buildings have them next to the lifts. Will the lifts trigger when people go to the toilet? Sometimes they have kitchens there too. What if they need to go to another floor and have not made an appointment - will they have to go back to their offices, put it on their calendars then return to the lifts? What about maintenance people who need to get somewhere quickly?

I am just curious.
Excellent questions.

Let's make things a bit more automated.

So each office/kitchen/toilet needs three Bluetooth Location Beacons. For best battery life, we will standardize on ones that use the Bluetooth 4.0 LE protocol.

Why 3? We need to triangulate the user's location in time and space. Not only intra room, but also inter room and inter floor.

This means we need to write two apps, one for Android and one for iOS. Forget about Huawei devices. Those idiots are on their own.

The app will run as a service constantly transmitting its location between beacons. This will enable us to not only pinpoint it's location, but also help in determining whether the bearer is moving.

So. Once we realise a person is moving, we determine the direction they're moving into. If in the direction of the elevator shafts, we summon the closest elevator to the floor in question.

For visitors we use one of the Microsoft API's to determine when they will arrive for their appointments. We then "book" an elevator to be on standby for once they arrive on ground.

Back to the location beacons. We have to implement machine learning and probability theory to determine a person's habits. For example at 9am we will learn when he has to go to the toilet after having Java.

We will need a more powerful processor with more RAM. So let's use a Pi to coordinate and control the microprocessors and beacons.
 
Excellent questions.

Let's make things a bit more automated.

So each office/kitchen/toilet needs three Bluetooth Location Beacons. For best battery life, we will standardize on ones that use the Bluetooth 4.0 LE protocol.

Why 3? We need to triangulate the user's location in time and space. Not only intra room, but also inter room and inter floor.

This means we need to write two apps, one for Android and one for iOS. Forget about Huawei devices. Those idiots are on their own.

The app will run as a service constantly transmitting its location between beacons. This will enable us to not only pinpoint it's location, but also help in determining whether the bearer is moving.

So. Once we realise a person is moving, we determine the direction they're moving into. If in the direction of the elevator shafts, we summon the closest elevator to the floor in question.

For visitors we use one of the Microsoft API's to determine when they will arrive for their appointments. We then "book" an elevator to be on standby for once they arrive on ground.

Back to the location beacons. We have to implement machine learning and probability theory to determine a person's habits. For example at 9am we will learn when he has to go to the toilet after having Java.

We will need a more powerful processor with more RAM. So let's use a Pi to coordinate and control the microprocessors and beacons.
This, while fascinating, gives me 1984 or police state vibes. A Sci-fi horror where the building has AI and is in control of everything. I can see someone walking to the lifts - while looking at their phone. The doors open and the person walks through - only to find there is no lift.
 
This position pays R162k per month.

So I need:
Mobile app development (Flutter preference)
Java
C÷÷
SOA (Rest is an option) design and implentation (I'll write most of this, but I need someone to know how to integrate) using extensive use of UUID and nonces
Knowledge of embedded coding
Knowledge of the Bluetooth stack, especially the later ones
 
This position pays R162k per month.

So I need:
Mobile app development (Flutter preference)
Java
C÷÷
SOA (Rest is an option) design and implentation (I'll write most of this, but I need someone to know how to integrate) using extensive use of UUID and nonces
Knowledge of embedded coding
Knowledge of the Bluetooth stack, especially the later ones
I have a good friend who is looking for a change. Can I ask him to contact you?
 
Last edited:
Top
Sign up to the MyBroadband newsletter
X