action button to control instrument (http request)

Hi,

I am making an rshiny app to control an instrument at work. The instrument is controlled via entering addresses into a browser. I.e. to pause the instrument the following in a browser would pause the instrument 'http://192.168.0.55/command/action/pause/1'.

I'm having trouble getting an action button to simply enter the address via GET or read_html. I have tried numerous approaches. This is my current one. Please note I do not want the action button to open a page - onclick ="window.open("address").

This is currently where I am at.

# Load packages ----
library(shiny)
library(textreadr)
library(httr)
library(readr)

# Source helper functions -----

# User interface ----
ui <- navbarPage(title = "tab1",
                 
                 tabPanel("Control", 
                          actionButton("do", "Click Me"),
                          textOutput("update_ping"), 
                          
                          
                 )
)




# Define server logic required to draw a histogram
server <- function(input, output) {
  
output$update_ping <- renderText(purge) 
observeEvent(input$do, {purge <- read_file("http://192.168.0.55/command/action/pause/1")})


}

# Run the application 
shinyApp(ui = ui, server = server)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.