cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1553
Views
2
Helpful
2
Replies

Using the time in Cisco PT for IoT device with MCU

jk865
Level 1
Level 1

Hi All 

Thanks in advance. 

I am trying to create an IoT design that makes use of the time within Cisco PT , for example if it's past 8am the door is open. 

I can't see anywhere or any way of using the time (within the PT file) to action a function 

Can anyone confirm if it's even possible? (Im told it is) 

Thanks 

2 Replies 2

Alexander Stevenson
Cisco Employee
Cisco Employee

Hi @jk865,

I think it's possible as the time library is being imported in this video

IoT Device Programming using Packet Tracer with Sensors and Actuators - YouTube

You would just need to find a way to set the time, with the date module or find an innovative way

I hope this helps!

Yes, it is possible to use the time within Cisco PT to trigger an action in an IoT design. You can use a timer or clock module within Cisco PT to keep track of the time, and then use an if-else statement to check the time and trigger an action based on the time.

For example, you can create a timer module and set it to start at a specific time, say 8am. You can then use an if-else statement to check if the current time is after 8am, and if so, trigger an action to open the door.

Here's some sample code that demonstrates this concept:

makefile
Copy code
timer_start_time = "08:00:00"
current_time = timer.get_time()
if current_time > timer_start_time:
door.open()
This code sets the timer to start at 8am, gets the current time, and then checks if the current time is after 8am. If it is, it triggers the action to open the door.

Of course, you'll need to modify this code to fit your specific IoT design, but this should give you an idea of how to use the time within Cisco PT to trigger an action.