Scripting a button press to turn on a PLC tag

Not sure if this is the right place. Trying to use the maker edition and a s7 1200 trainer kit to learn this software. Got everything connected finally and now I’m having a hard time trying to figure out how to link my tag to a button press. Do I need to script it? Not seeing an option to bind a button press like some articles suggest for the perspective vs the view I’m currently using. Sorry if this is a common question. Not sure how to format a button press for ignition quite yet. Thanks for any help

You should be more specific about what you’re trying to achieve with the button press.

What is the tag’s data type?
What do you want to happen when the button is pressed? “Linking” doesn’t really give us any information.

I can tell you that using a script is the most common way we see buttons used. You should configure a script on a button’s actionPerformed event. From the script, you can write a line of code to do a vast variety of things.

Yep is a really basic question but this is why forums are for.
Choose the button based on the kind of logic configured in the PLC, use one shoot button when sending a flag and waits a handshake.
Most of the time you can use a standard button with a really simple script using system.tag.writeBlocking.

Also explore the possibility to use tag bidirectional binging Tag Bindings in Perspective

I want to on button press turn the bool value of a tag such as MX1.0 from a 0 to 1 then return back to 0. A momentary button. I’m using view and not perspective as this is the maker edition currently.

This forum post gives a good solution;

It's best to have a button set the value to 1 using a script. (Right click the button -> Configure Events, then use the system.tag.writeBlocking() function to write to the tag). Then program the PLC to reset the value back to 0 after a given time.

If you want to do this only from ignition, refer to the forum post and use some form of sleep() or threading.Timer to write a 0 back to the tag after a specified time.

so if they example was this, system.tag.writeBlocking(paths, values)
Would writing system.tag.writeBlocking(MX1.0, 1) work to right a 1 value into the tag on button press?

or is the path my tag name in ignition, such as if MX1.0 is assigned to an OPC tag called Switch 1 would it be (Switch 1, 1)

This example is right out of the manual, its writing to 2 tags, but you can use this setup to write a single tag. Its not a bad idea to use this format vs directly coding your path and value int the writeBlocking operation.

# Create a list with the tag paths to be updated.
paths = ["[default]Folder/Tag_A","[default]Folder/Tag_B"]
 
# Create a list with the update values, one value for each path.
values = [1,2]
 
# Execute the write operation.
system.tag.writeBlocking(paths, values)